What is the relationship between the depth of a node and its index in an array-based representation of a complete Binary Tree?
Depth = Index
Depth = 2 * Index
Depth = log2(Index + 1)
Depth = Index / 2
What is the difference between the height and depth of a node in a binary tree?
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 is always one more than the depth of a node.
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.
Height and depth are the same thing.
What is the time complexity of calculating the height of a binary tree?
O(n)
O(log n)
O(1)
O(n^2)
What is the time complexity of finding the LCA in a Binary Search Tree (BST) in the worst case?
O(n log n)
Why are two stacks often used in the iterative implementation of Postorder Traversal?
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.
One stack stores the nodes to be visited, and the other stores the visited nodes.
Level Order Traversal of a Binary Tree is also known as?
Postorder Traversal
Depth First Search (DFS)
Breadth First Search (BFS)
Preorder Traversal
When performing a search for a value in a BST, what happens if the value is not found?
A null pointer or a special value indicating the absence of the value is returned.
An error is raised.
The closest value in the BST is returned.
The search continues indefinitely.
Inorder Traversal is particularly useful for which of the following applications?
Printing the nodes of a BST in sorted order.
Checking if a Binary Tree is balanced.
Finding the diameter of a Binary Tree.
Finding the height of a Binary Tree.
What is the time complexity of searching for a specific value in a perfectly balanced BST?
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