Class PriorityQueueExample
java.lang.Object
topics.foundation.structures.PriorityQueueExample
PriorityQueue Demonstration
Demonstrates fundamental operations on a PriorityQueue.
This collection is backed by a priority heap data structure, which orders elements
according to their natural mathematical ordering (or a specified comparator)
rather than their chronological insertion sequence (FIFO).
Complexity
- Time Complexity:
O(log N)for insertion (add) and extraction (poll) as the binary tree structurally rebalances.O(N)for arbitrary value-based removals (remove(Object)), as the structure requires a linear scan to locate the target node before repairing the heap.O(1)for inspecting the highest-priority element at the root (peek).
- Space Complexity:
O(N)to maintain the dynamically resizing contiguous array representing the binary heap.
- Author:
- vicegd
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
PriorityQueueExample
public PriorityQueueExample()
-
-
Method Details
-
main
Main execution entry point.- Parameters:
args- Command-line arguments (not utilized).
-