Q. What happens when a node is inserted into an AVL tree and it causes an imbalance?
-
A.
The tree is deleted.
-
B.
The tree is restructured using rotations.
-
C.
The node is removed.
-
D.
No action is taken.
Solution
When an imbalance occurs after insertion in an AVL tree, the tree is restructured using rotations to restore balance.
Correct Answer:
B
— The tree is restructured using rotations.
Learn More →
Q. What is a common use case for Red-Black trees?
-
A.
Memory management
-
B.
Implementing associative arrays
-
C.
Sorting algorithms
-
D.
Graph traversal
Solution
Red-Black trees are often used to implement associative arrays due to their balanced nature.
Correct Answer:
B
— Implementing associative arrays
Learn More →
Q. Which of the following is a real-world application of Red-Black trees?
-
A.
Memory management in operating systems
-
B.
Database indexing
-
C.
Network routing algorithms
-
D.
All of the above
Solution
Red-Black trees are used in various applications including memory management, database indexing, and network routing due to their balanced nature.
Correct Answer:
D
— All of the above
Learn More →
Q. Which traversal method is commonly used to retrieve data from a Red-Black tree in sorted order?
-
A.
Pre-order traversal
-
B.
In-order traversal
-
C.
Post-order traversal
-
D.
Level-order traversal
Solution
In-order traversal of a Red-Black tree retrieves the data in sorted order due to its properties as a binary search tree.
Correct Answer:
B
— In-order traversal
Learn More →
Showing 1 to 4 of 4 (1 Pages)