For stack :- Keep incrementing the priority of each pushed element. So
the last pushed element will have the greatest priority and the
element pushed first will have
lowest priority.
For queue:- keep decrementing the priority of each inserted element.

On Sep 13, 1:45 am, Ankur Garg <ankurga...@gmail.com> wrote:
> How to Implement a Queue with a Priority Queue
> Similarly how woud you implement Stack with Priority Queue

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