Could you please explain a dry run.
Lets say you have a list of element arr[] = {5, 3, 10, 9, 8, 23, 11, 4,13,
6, -1}.On fly we took user input and the user enters 12 . This can be formed of 12( one example like (13, -1) , (10, 3, -1) ) Could you please educate me how ur algo gona work on this scenario ? *Subhransu Panigrahi * *Mobile:* *+91-9840931538* *Email:* [email protected] On Sat, May 28, 2011 at 10:47 AM, Aakash Johari <[email protected]>wrote: > @Dave: I have suggested another solution in previous threads. Please go > through that. That is without maps. It uses array for mapping. > > > On Fri, May 27, 2011 at 10:09 PM, Dave <[email protected]> wrote: > >> If map insertion is O(log n), then the algorithms that insert each >> element into the map will be O(n log n), but the problem statement >> insists that we find two elements of the array that sum to a given >> number in O(n) time. Thus, Aakash's solution (http://groups.google.com/ >> group/algogeeks/msg/541180b4f2d6c930) using map doesn't satisfy the >> time requirement. >> >> Dave >> >> On May 27, 3:38 am, anshu mishra <[email protected]> wrote: >> > map is internally implemented with balanced binary tree and inserting in >> a >> > BST is o(logn); >> >> -- >> 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. >> >> > > > -- > -Aakash Johari > (IIIT Allahabad) > > > > > > -- > 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. > -- 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.
