We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent aacd909 commit 509d997Copy full SHA for 509d997
1 file changed
src/CollectionsFramework/Day_5/MinHeapExample.java
@@ -0,0 +1,17 @@
1
+package CollectionsFramework.Day_5;
2
+
3
+import java.util.PriorityQueue;
4
5
+public class MinHeapExample {
6
7
+ public static void main(String[] args) {
8
+ PriorityQueue<Integer> minHeap = new PriorityQueue<>();
9
+ minHeap.add(40);
10
+ minHeap.add(10);
11
+ minHeap.add(30);
12
13
+ while (!minHeap.isEmpty()) {
14
+ System.out.print(minHeap.poll() + " "); // 10, 30, 40
15
+ }
16
17
+}
0 commit comments