What is the time complexity of decoding a message encoded using Huffman coding, assuming you have the constructed Huffman tree?
O(log n)
O(n log n)
O(n)
O(1)
Which type of tree rotation is performed when a node's balance factor becomes 2 and its right child's balance factor is -1?
Left Rotation
Right-Left Rotation
Left-Right Rotation
Right Rotation
What is the maximum number of nodes in a binary tree of height 'h'?
2^(h+1) - 1
2h - 1
h + 1
2^h
You need to serialize a binary tree into a string representation. Which method is generally considered MORE space-efficient for trees with many nodes having only one child?
Postorder Traversal with null markers
Level Order Traversal with null markers
Inorder Traversal with null markers
Preorder Traversal with null markers ('N' for null nodes)
In a Threaded Binary Tree, what is the primary purpose of threading?
To simplify the insertion and deletion of nodes.
To enable more efficient searching algorithms.
To allow traversal of the tree without recursion or stacks.
To reduce the space complexity of storing the tree structure.
You need to transmit a large file containing English text. Using a Huffman tree, which of these characters is likely to have the shortest codeword?
z
e
q
A certain algorithm requires a binary tree where all operations (insertion, deletion, search) must be guaranteed to be O(log n) in the worst case. Which type of tree is MOST suitable for this scenario?
Complete Binary Tree
Balanced Binary Tree
Perfect Binary Tree
Full Binary Tree
What is the worst-case time complexity for searching for a specific value in a perfectly balanced BST?
Consider a Binary Search Tree (BST). What is the time complexity of finding the LCA of two nodes in the BEST-CASE scenario?
When constructing a Segment Tree for a given array, what information is typically stored in each node of the Segment Tree?
It depends on the specific application and the type of queries the Segment Tree is designed to handle.
The minimum value within the corresponding subarray of the original array.
The sum of all elements in the corresponding subarray of the original array.
A statistical measure (like mean or median) of the corresponding subarray.