Priority Colors: Red = High (1-2), Orange = Medium (3-4), Green = Low (5+)
Priority Queue is an abstract data type where each element has an associated priority.
Key Characteristics:
Why use Priority Queues?
Common Applications:
Operation | Time Complexity | Space Complexity |
---|---|---|
Enqueue | O(log n) | O(1) |
Dequeue | O(log n) | O(1) |
Peek | O(1) | O(1) |
Search | O(n) | O(1) |
Traversal | O(n) | O(1) |
Strengths:
Limitations: