My Math Forum Algorithms tracing question

 Computer Science Computer Science Forum

 January 6th, 2019, 07:07 AM #1 Member   Joined: Oct 2017 From: Rumba Posts: 39 Thanks: 0 Algorithms tracing question http://prntscr.com/m3qhrw Solution 1 A) 5,7,9,3,9,14 Compare 5 with 7,9,3,9,14 (no match) Compare 7 with 9,3,9,14 (no match) Compare 9 with 3,9 (match 9=9) so returns false. Solution 2 A) array values are values 5 7 9 3 9 14 i from 0-->4 0 1 2 3 4 j from 1-->5 1 2 3 4 5 when i reaches 3rd loop in uniqueElements1 algorithm it find a[i]==a[j] for i==2 and j==4 and returns false. so no of iteration =3 for i loop Which solution is correct and why?

 Tags algorithms, question, tracing

 Thread Tools Display Modes Linear Mode

 Similar Threads Thread Thread Starter Forum Replies Last Post sita Computer Science 6 December 3rd, 2018 04:19 PM sita Computer Science 3 November 3rd, 2018 09:36 AM sita Computer Science 6 November 2nd, 2018 06:57 PM OriaG Calculus 9 June 8th, 2015 08:13 PM jomagam Applied Math 4 October 8th, 2013 01:53 PM

 Contact - Home - Forums - Cryptocurrency Forum - Top