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.
