Question 121
[Q.21] What is the minimum number of queues required to implement a priority queue efficiently?
A Priority Queue is standardly implemented using a single Heap data structure.
[Q.21] What is the minimum number of queues required to implement a priority queue efficiently?
A Priority Queue is standardly implemented using a single Heap data structure.
[Q.22] In a max-heap of size n, where is the minimum element located?
In a max-heap, parent nodes are greater than children; hence the minimum element must be a leaf node.
[Q.23] What is the time complexity to insert an element at the beginning of a singly linked list with head pointer?
Inserting at the head requires updating 2 pointers, taking constant O(1) time.
[Q.24] Which algorithm design paradigm does Merge Sort use?
Merge Sort divides the array into sub-arrays, recursively sorts them, and merges the results.
[Q.25] What is the maximum number of nodes in a binary tree of height h (where height of root is 0)?
$Total nodes = 2^0 + 2^1 + ... + 2^h = 2^{h+1} - 1.$