In a Perfect Binary Tree with height 'h', what is the maximum number of nodes it can have?
2^h - 1
2^(h+1) - 1
2h + 1
h^2
You have serialized a binary tree using preorder traversal with null markers. During deserialization, which data structure is MOST suitable for efficiently reconstructing the tree from the serialized string?
Queue
Heap
Stack
Linked List
If a Perfect Binary Tree has 15 nodes, what is its height?
7
15
3
4
Imagine a scenario where you are transmitting a binary tree over a network. You choose to serialize it using a level-order approach with null markers. What potential drawback should you be aware of?
For skewed trees, level-order representation can be space-inefficient due to many null nodes.
Level-order serialization disrupts the structural information of the binary tree.
Level-order serialization is not suitable for transmission due to its variable-length representation.
Deserializing a level-order string is computationally expensive on the receiving end.
What is the worst-case time complexity for searching for a specific value in a perfectly balanced BST?
O(log n)
O(n)
O(n log n)
O(1)
What is the primary advantage of using a Fenwick tree over a segment tree for range sum queries?
Fenwick trees use less memory
Fenwick trees have faster update operations
Fenwick trees are easier to implement
Fenwick trees support a wider range of queries
In a Threaded Binary Tree, what is the primary purpose of threading?
To simplify the insertion and deletion of nodes.
To reduce the space complexity of storing the tree structure.
To allow traversal of the tree without recursion or stacks.
To enable more efficient searching algorithms.
Which of the following is NOT a type of self-balancing BST?
Binary Heap
Red-Black Tree
B-Tree
AVL Tree
You are tasked with determining if two binary trees are mirrors of each other. Which traversal method pair can be used to efficiently compare the trees?
Preorder of one tree with Inorder of the other
Level Order of both trees
Inorder of both trees
Preorder of one tree with Postorder of the other
Which of the following real-world scenarios would be well-suited for using a Segment Tree data structure?
Storing and querying historical stock prices for a particular company.
All of the above.
Finding the shortest path between two nodes in a weighted graph.
Implementing an undo/redo functionality in a text editor.