Q. In a Red-Black tree, what happens when a red node is inserted?
-
A.
It is always the root.
-
B.
It may cause a violation of Red-Black properties.
-
C.
It is always a leaf.
-
D.
It cannot be inserted.
Solution
Inserting a red node may cause a violation of the Red-Black properties, requiring adjustments.
Correct Answer:
B
— It may cause a violation of Red-Black properties.
Learn More →
Q. In a Red-Black tree, what is the maximum height of the tree in terms of the number of nodes n?
-
A.
2n
-
B.
n
-
C.
log(n)
-
D.
2 * log(n)
Solution
The maximum height of a Red-Black tree is 2 * log(n), ensuring that the tree remains balanced.
Correct Answer:
D
— 2 * log(n)
Learn More →
Q. Which of the following is true about AVL trees compared to Red-Black trees?
-
A.
AVL trees are faster for lookup operations.
-
B.
Red-Black trees are faster for lookup operations.
-
C.
Both have the same performance.
-
D.
AVL trees are easier to implement.
Solution
AVL trees are generally faster for lookup operations due to their stricter balancing.
Correct Answer:
A
— AVL trees are faster for lookup operations.
Learn More →
Q. Which of the following operations is more efficient in a Red-Black tree compared to an AVL tree?
-
A.
Insertion
-
B.
Deletion
-
C.
Searching
-
D.
All of the above
Solution
Deletion is generally more efficient in Red-Black trees due to fewer rotations required compared to AVL trees.
Correct Answer:
B
— Deletion
Learn More →
Showing 1 to 4 of 4 (1 Pages)