Basic tasks with priority queues in java.

This commit is contained in:
Tomasz Półgrabia 2025-02-10 11:50:56 +01:00
parent 6b89476e26
commit 2edf415e2a
3 changed files with 64 additions and 0 deletions

View file

@ -0,0 +1,23 @@
import java.util.*;
public class Program {
public static void main(String[] args) {
var arr = new ArrayList<Integer>();
arr.add(-4);
var pq = new PriorityQueue<Integer>();
pq.add(1);
pq.add(5);
pq.add(-3);
pq.add(-7);
System.out.printf("Hello World: %d\n", pq.remove());
System.out.printf("Hello World: %d\n", pq.remove());
System.out.printf("Hello World: %d\n", pq.remove());
System.out.printf("Hello World: %d\n", pq.remove());
}
}