What is the output of Preorder Traversal for the following Binary Tree: 1(2(4,5),3)?
4 5 2 3 1
1 2 4 5 3
1 3 2 4 5
4 2 5 1 3
If a perfect binary tree has a height of 'h', how many nodes are present in the tree?
2^(h+1) - 1
h^2
2h
2^h - 1
A full binary tree with 'k' internal nodes has how many total nodes?
k + 1
k
2k
2k + 1
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 it is visited before its children.
A node is a leaf if both its left and right child pointers are NULL.
A node is a leaf if its value is less than its parent's value.
What is the time complexity of finding the LCA in a Binary Search Tree (BST) in the worst case?
O(n log n)
O(1)
O(n)
O(log n)
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 / 2
Depth = log2(Index + 1)
Depth = Index
Depth = 2 * Index
What is the difference between Postorder and Inorder Traversal?
There is no significant difference; both traversals produce the same output.
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.
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.
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 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.
Height is always one more than the depth of a node.
Which type of binary tree is particularly well-suited for representing relationships where each node has exactly two children (e.g., representing expressions in a compiler)?
Perfect Binary Tree
Full Binary Tree
Skewed Binary Tree
Complete Binary Tree
What is the time complexity of finding all root-to-leaf paths in a Binary Tree?
O(n^2)