What is the primary advantage of using an iterative approach (with a stack) over recursion for Inorder Traversal?
Iterative traversal is generally faster.
Iterative traversal is easier to understand and implement.
There is no significant advantage; both approaches have similar performance.
Iterative traversal avoids function call overhead and potential stack overflow for very deep trees.
How can you identify leaf nodes during a preorder traversal of a binary tree?
It is not possible to identify leaf nodes during preorder traversal.
A node is a leaf if its value is less than its parent's value.
A node is a leaf if it is visited before its children.
A node is a leaf if both its left and right child pointers are NULL.
Which data structure is used in the iterative implementation of Preorder Traversal?
Stack
Queue
Linked List
Heap
If a perfect binary tree has a height of 'h', how many nodes are present in the tree?
h^2
2^(h+1) - 1
2^h - 1
2h
Level Order Traversal of a Binary Tree is also known as?
Breadth First Search (BFS)
Preorder Traversal
Depth First Search (DFS)
Postorder Traversal
What is the difference between the height and depth of a node in a binary tree?
Height is always one more than the depth of a node.
Height is the number of edges from the root to the node, while depth is the number of nodes from the root to the node.
Height and depth are the same thing.
Height is the number of edges from the node to the deepest leaf, while depth is the number of edges from the root to the node.
Which of the following is NOT a typical application of Binary Search Trees?
Representing a graph data structure
Storing and retrieving data in a specific order
Implementing sorted sets and maps
Finding the median of a dataset
What is the time complexity of calculating the height of a binary tree?
O(log n)
O(n^2)
O(n)
O(1)
Which of the following statements is true about AVL trees?
AVL trees are a type of Red-Black tree.
AVL trees guarantee a maximum height difference of 1 between the left and right subtrees of any node.
AVL trees do not require any rotations to maintain balance.
AVL trees are always perfectly balanced.
A complete binary tree with 'n' nodes has a height of?
n - 1
floor(log2(n))
log2(n) + 1
n/2