Question 21
Which technique is used in Huffman Coding to generate optimal prefix-free variable-length codes?
Huffman Coding greedily combines the two lowest-frequency symbols/trees at each step to construct an optimal prefix tree.
Which technique is used in Huffman Coding to generate optimal prefix-free variable-length codes?
Huffman Coding greedily combines the two lowest-frequency symbols/trees at each step to construct an optimal prefix tree.
What is the Space Complexity of Depth First Search (DFS) on a tree of height H?
On a tree, DFS only stores nodes along the current path from root to leaf in its call stack, consuming O(H) memory.
Which algorithm can detect a cycle in an undirected graph in O(V + E) time when run across all connected components?
BFS can detect a cycle in an undirected graph by tracking each vertex's parent: an already visited neighbor that is not the parent indicates a cycle. DFS can also do this in O(V + E).
What is the auxiliary space complexity of Merge Sort on an array of size N?
Standard Merge Sort requires an auxiliary array of size N to temporarily hold merged sub-arrays during the merge phase.
Which data structure stores characters and their frequencies in a prefix tree to speed up string search queries?
A Trie (prefix tree) stores string characters along tree edges, allowing pattern/prefix matching in O(L) time where L is key length.