Which of the following is a common application of Binary Tree serialization?
Finding the shortest path in a graph
Storing and retrieving trees in a file or database
Implementing a hash table
Sorting data
Red-Black trees introduce the concept of 'color' to nodes (red or black). What is the primary purpose of this color scheme?
To enable efficient searching for nodes based on their color
To maintain a relaxed form of balance, allowing for faster insertion and deletion compared to strictly balanced trees
To enforce a specific order of nodes during insertion
To simplify the visualization of the tree structure
How can you identify leaf nodes during a preorder traversal of a binary tree?
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.
A node is a leaf if it is visited before its children.
It is not possible to identify leaf nodes during preorder traversal.
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.
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.
Postorder is used for deleting nodes in a Binary Tree, while Inorder is used for printing the nodes in sorted order.
What is the height of a perfect binary tree with 'n' nodes?
log2(n)
n - 1
n/2
log2(n + 1) - 1
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?
Perfect Binary Tree
Degenerate Binary Tree
Full Binary Tree
Complete Binary Tree
When performing a search for a value in a BST, what happens if the value is not found?
The search continues indefinitely.
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.
If a perfect binary tree has a height of 'h', how many nodes are present in the tree?
2h
h^2
2^h - 1
2^(h+1) - 1
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 = 2 * I
L = I + 1
L = I
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.