On two occasions I have been asked [by members of Parliament]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. Charles Babbage

Priority queue using stack

Language Java | Level Intermediate | Category Data structure | September 9, 2015 9:45 am

Data structure Description

A priority queue is a data structure with each element associated with priority information. The high priority served before an element with low priority.

Write a program to implement Priority queue using stack



Array of items for insert Priority Queue: [4, 1, 3, 2, 16, 9, 10, 14, 8, 7]
Array of items Peek from Priority Queue: 1 2 3 4 7 8 9 10 14 16



No comments available!

Please login to add comments.