Commit ecfce5e
committed
feat: add PriorityQueueDemo showing custom ordering using Comparator in PriorityQueue
Implemented PriorityQueueDemo.java to demonstrate reverse (max-heap) ordering
via a user-defined Comparator. Highlights how PriorityQueue can be customized
beyond natural ordering, using compare() logic to prioritize higher values.
Includes peek(), poll(), and iteration to show heap behavior before and after deletion.
Signed-off-by: https://github.com/Someshdiwan <someshdiwan369@gmail.com>1 parent 32c6411 commit ecfce5e
1 file changed
Lines changed: 1 addition & 2 deletions
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| |||
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
36 | | - | |
| 35 | + | |
0 commit comments