Q. How do you perform a left rotation in an AVL tree?
-
A.
By moving the right child up and the current node down.
-
B.
By moving the left child up and the current node down.
-
C.
By swapping the current node with its parent.
-
D.
By reversing the tree structure.
Solution
A left rotation involves moving the right child of a node up to take its place, while the current node becomes the left child of the new root.
Correct Answer:
A
— By moving the right child up and the current node down.
Learn More →
Q. What is the main advantage of using Red-Black trees over AVL trees?
-
A.
Faster search times.
-
B.
Less strict balancing, leading to faster insertions and deletions.
-
C.
Easier implementation.
-
D.
More memory usage.
Solution
Red-Black trees allow for less strict balancing compared to AVL trees, which can lead to faster insertions and deletions.
Correct Answer:
B
— Less strict balancing, leading to faster insertions and deletions.
Learn More →
Showing 1 to 2 of 2 (1 Pages)