What is the primary advantage of using a balanced BST over an unbalanced BST?
Faster insertion operations
Guaranteed constant-time search complexity
Improved worst-case time complexity for search, insertion, and deletion
Reduced memory usage
When performing a search for a value in a BST, what happens if the value is not found?
The search continues indefinitely.
An error is raised.
A null pointer or a special value indicating the absence of the value is returned.
The closest value in the BST is returned.
Which data structure is most suitable for efficiently finding a path with a given sum in a Binary Tree?
Queue
Stack
Heap
Hash Set
Why are two stacks often used in the iterative implementation of Postorder Traversal?
One stack stores the nodes to be visited, and the other stores the visited nodes.
One stack stores the nodes in preorder, and the other stores them in inorder, allowing us to derive the postorder.
One stack is used for the left subtree traversal, and the other for the right subtree traversal.
Two stacks are not strictly required; one stack is sufficient for iterative Postorder Traversal.
What is the output of Preorder Traversal for the following Binary Tree: 1(2(4,5),3)?
4 5 2 3 1
4 2 5 1 3
1 2 4 5 3
1 3 2 4 5
What is the primary advantage of using an iterative approach (with a stack) over recursion for Inorder Traversal?
Iterative traversal avoids function call overhead and potential stack overflow for very deep trees.
Iterative traversal is easier to understand and implement.
Iterative traversal is generally faster.
There is no significant advantage; both approaches have similar performance.
A full binary tree with 'k' internal nodes has how many total nodes?
2k
2k + 1
k + 1
k
What is the difference between Postorder and Inorder Traversal?
Postorder is used for deleting nodes in a Binary Tree, while Inorder is used for printing the nodes in sorted order.
Postorder visits the root node before its children, while Inorder visits the root between its left and right children.
There is no significant difference; both traversals produce the same output.
Postorder visits the left subtree, then the right subtree, and finally the root, while Inorder visits the left subtree, the root, and then the right subtree.
Is it possible for a full binary tree to have an even number of nodes?
No
Yes
What is the relationship between the number of leaf nodes (L) and the number of internal nodes (I) in a full binary tree?
L = I - 1
L = I
L = I + 1
L = 2 * I