Skip to content

Commit

Permalink
Priority Queue through java collection framework to add integer
Browse files Browse the repository at this point in the history
  • Loading branch information
Ankush1oo8 committed Mar 9, 2024
1 parent d633340 commit ba2b319
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Heap/Priotrity_Queue.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package Heap;
import java.util.*;
public class Priotrity_Queue {
public static void main(String[] args) {
PriorityQueue<Integer> q=new PriorityQueue<>();
q.add(13);
q.add(2);
q.add(-1);
q.add(69);
System.out.println(q);
while(!q.isEmpty()){
System.out.println(q.peek());
q.remove();
}
}
}

0 comments on commit ba2b319

Please sign in to comment.