/Implementation-of-priority-queue

Implementation of priority queue using Binary heap(minHeap and maxHeap).

Primary LanguageJava

Implementation-of-priority-queue

Implementation of priority queue using Binary heap(minHeap and maxHeap).

Compiling the code in IntelliJ Idea: ->create a empty project. ->Navigate to 'projectName'->src folder. ->paste the unzipped folder inside the src folder. ->In the above menu select Run->Run... ->select the 'className' ->Running the code:

Initially the doubly linked list gets initialized with elements from 0 to 9. Option 1 : get the peeked element.(Returns the root element always.) Option 2 : Add an element into the heap.(Throws Array Index Out of Bound if the heap is full.) Option 3 : Offer an element into the heap.(Throws no error but returns false if insertion is not successful.) Option 4 : Removes an element from the heap.(Throws No such element exception if the heap is empty.) Option 5 : Polls an element from the heap.(Throws no error but returns null if it is empty.) Option 6 : Print the heap elements.