Use a linked list (maintain both head and tail positions) and treat it
as a queue.... insert/delete front or back... whatever...

For each insert, see if it's less than the current min and maintain
min... If you're deleting the current min, you may traverse from head
to tail and recompute the min...

On Jan 1, 9:23 pm, sourav <souravs...@gmail.com> wrote:
> Implement a queue in which push_rear(), pop_front() and get_min() are
> all constant time operations.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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