What is the difference between the height and depth of a node in a binary tree?
Height and depth are the same thing.
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 is the number of edges from the root to the node, while depth is the number of nodes from the root to the node.
When performing a search for a value in a BST, what happens if the value is not found?
The closest value in the BST is returned.
The search continues indefinitely.
An error is raised.
A null pointer or a special value indicating the absence of the value is returned.
What is the time complexity of calculating the height of a binary tree?
O(1)
O(log n)
O(n)
O(n^2)
Perfect binary trees are commonly used in which of the following applications due to their balanced structure and efficient space utilization?
Trie Data Structures
Heap Sort
Hash Tables
Binary Search Trees
A full binary tree with 'k' internal nodes has how many total nodes?
2k
k
k + 1
2k + 1
What is the space complexity of finding the LCA in a Binary Tree using a recursive approach?
O(n log n)
Which of the following is NOT a typical application of Binary Search Trees?
Implementing sorted sets and maps
Representing a graph data structure
Finding the median of a dataset
Storing and retrieving data in a specific order
Which of the following types of binary trees guarantees that all levels except possibly the last are completely filled, and the last level has all keys as left as possible?
Full Binary Tree
Degenerate Binary Tree
Perfect Binary Tree
Complete Binary Tree
What is the difference between Postorder and Inorder Traversal?
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.
Postorder is used for deleting nodes in a Binary Tree, while Inorder is used for printing the nodes in sorted order.
There is no significant difference; both traversals produce the same output.
Postorder visits the root node before its children, while Inorder visits the root between its left and right children.
What is the time complexity of finding the LCA in a Binary Search Tree (BST) in the worst case?