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 <[email protected]> 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 [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.
