@manisha
i think u didn't get my point

every time it will return the different value
ex
values to be pushed 6,5,10,3,9,1
now push(a,b) a=element b=minimum value pushed till now
(6,6)
(6,6),(5,5)
(6,6),(5,5),(10,5)
(6,6),(5,5),(10,5),(3,3)
(6,6),(5,5),(10,5),(3,3),(9,3)
(6,6),(5,5),(10,5),(3,3),(9,3),(1,1)


now start popping
(1,1) min in stack=1
(9,3) min in stack =3
similarly
last (6,6) min in stack=6

so everytime u get min in O(1)

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to