let arr is given array of size N. find the max_number in arr. O(n)
form an aux array of size_max initiaize all elemnts of aux to 0. O(n) for(i=0;i<N;i++) O(n) if(aux[arr[i]]>0) return arr[i]; //duplicate element else aux[arr[i]]=i+1; the solution requires extra memory. pls correct me if i am wrong. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
