@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.

Reply via email to