Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

heap in java


In Java PriorityQueue can be used as a Heap.

Min Heap
PriorityQueue<Integer> minHeap = new PriorityQueue<>();


Max Heap:
PriorityQueue<Integer> maxHeap = new PriorityQueue<>(Comparator.reverseOrder());
 
PREVIOUS NEXT
Tagged: #heap #java
ADD COMMENT
Topic
Name
6+1 =