Q. How many rotations are needed in the worst case when inserting a node into an AVL tree?
Solution
In the worst case, inserting a node into an AVL tree may require up to 2 rotations to restore balance.
Correct Answer:
C
— 3
Learn More →
Q. What happens when you insert a node into an AVL tree that causes it to become unbalanced?
-
A.
The tree is deleted.
-
B.
The tree is restructured and rebalanced.
-
C.
The node is ignored.
-
D.
The tree becomes a binary tree.
Solution
When an insertion causes an AVL tree to become unbalanced, rotations are performed to restore balance.
Correct Answer:
B
— The tree is restructured and rebalanced.
Learn More →
Q. Which of the following operations is not allowed in a Red-Black tree?
-
A.
Insertion
-
B.
Deletion
-
C.
Searching
-
D.
Creating a node with two red children
Solution
In a Red-Black tree, a node cannot have two red children, as it violates the properties of the tree.
Correct Answer:
D
— Creating a node with two red children
Learn More →
Showing 1 to 3 of 3 (1 Pages)