Which data structure is most efficient for implementing a priority queue?
A
Simple Linked List
B
Stack
C
Array
D
Heap
Correct Answer: Option D — Heap
Explanation:
A heap is generally the most efficient data structure for implementing a priority queue because it allows insertion and removal of the highe...
A heap is generally the most efficient data structure for implementing a priority queue because it allows insertion and removal of the highest or lowest priority element in logarithmic time. Arrays and stacks are far less efficient for this purpose.