Which data structure is best suited for implementing a priority queue?
- Array
- Linked List
- Heap
- Stack
Answer: Heap
Heap (specifically binary heap) efficiently implements priority queue with O(log n) insertion and extraction of highest/lowest priority element. Arrays/lists require O(n) search for priority element. Heaps maintain partial order: parent node has higher/lower priority than children. Used in scheduling, Dijkstra's algorithm, and event simulation.