552 views
0 votes
0 votes
Which of the following data structure is efficient to implement priority queue with basic operation such as insertion, deletion and searching?

A) Linked list

B) Sorted array

C) Heap

D) Hash table

1 Answer

0 votes
0 votes
Heap is generally preferred for priority queue implementation because heaps provide better performance compared arrays or linked list. In a Binary Heap, getHighestPriority() can be implemented in O(1) time, insert() can be implemented in O(Logn) time and deleteHighestPriority() can also be implemented in O(Logn) time.

Related questions

0 votes
0 votes
4 answers
3
Nukku asked Sep 21, 2019
2,704 views
A sorting technique that guarantees that records with same primary key in the same order in the sorted list as in the original unsorted list is said to be....
0 votes
0 votes
2 answers
4
amit166 asked Nov 24, 2018
260 views
Number of possible ordered trees with 3 nodes x,y,z