not possible to track min. because even if u keep track min position if u
pop tat element again we need to search for next min which isnot possible in
o(1)
correct me if im wrong

On Sun, Sep 4, 2011 at 10:38 PM, Sangeeta <sangeeta15...@gmail.com> wrote:

> How would you design a stack which,in addition to push and pop,also
> has a function min which returns the minimum element?push,pop and min
> should all operate in O(1) time
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to