
Computer Science Computer Science Forum 
 LinkBack  Thread Tools  Display Modes 
January 6th, 2019, 07:07 AM  #1 
Member Joined: Oct 2017 From: Rumba Posts: 37 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  

Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
BigO question  Algorithms  sita  Computer Science  6  December 3rd, 2018 04:19 PM 
Algorithms question help  sita  Computer Science  3  November 3rd, 2018 09:36 AM 
Algorithms question  sita  Computer Science  6  November 2nd, 2018 06:57 PM 
Difficult question on efficiency and algorithms  OriaG  Calculus  9  June 8th, 2015 08:13 PM 
Tracing a graph  jomagam  Applied Math  4  October 8th, 2013 01:53 PM 