Q. How many rotations are needed to balance an AVL tree after a single insertion?
Solution
Typically, only one rotation is needed to balance an AVL tree after a single insertion, unless it is a double rotation case.
Correct Answer:
B
— 1
Learn More →
Q. What color is the root node of a Red-Black tree?
-
A.
Red
-
B.
Black
-
C.
It can be either
-
D.
None of the above
Solution
The root node of a Red-Black tree is always black, which helps maintain the properties of the tree.
Correct Answer:
B
— Black
Learn More →
Q. What happens to the balance factor of an AVL tree after a node is deleted?
-
A.
It remains unchanged.
-
B.
It can become unbalanced.
-
C.
It always becomes 0.
-
D.
It can only increase.
Solution
After a node is deleted from an AVL tree, the balance factor can become unbalanced, requiring rebalancing operations.
Correct Answer:
B
— It can become unbalanced.
Learn More →
Q. When inserting a node into an AVL tree, what must be checked after insertion?
-
A.
If the tree is a complete binary tree.
-
B.
If the tree remains balanced.
-
C.
If the node is a leaf.
-
D.
If the node is red or black.
Solution
After inserting a node into an AVL tree, it is crucial to check if the tree remains balanced and perform rotations if necessary.
Correct Answer:
B
— If the tree remains balanced.
Learn More →
Showing 1 to 4 of 4 (1 Pages)