Commit 17c26fc
committed
feat: add PriorityQueueDemo1 demonstrating custom Comparator-based max-heap PriorityQueue
Implemented PriorityQueueDemo1.java to illustrate how PriorityQueue behavior can be
customized using a user-defined Comparator. Demonstrates descending order (max-heap)
prioritization with peek(), poll(), and iteration, showing element order before and
after deletion.
Signed-off-by: https://github.com/Someshdiwan <[email protected]>1 parent ecfce5e commit 17c26fc
File tree
1 file changed
+2
-3
lines changed- Section 25 Collections Frameworks/Queue Interface/Priority Queue/src
1 file changed
+2
-3
lines changedLines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| |||
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
36 | | - | |
| 35 | + | |
0 commit comments