Q. How many rotations are needed in the worst case when inserting a node in an AVL tree?
Solution
In the worst case, at most 2 rotations are needed to maintain the balance of an AVL tree after insertion.
Correct Answer:
B
— 2
Learn More →
Q. What is the time complexity of deleting a node from a Red-Black tree?
-
A.
O(n)
-
B.
O(log n)
-
C.
O(n log n)
-
D.
O(1)
Solution
The time complexity for deleting a node from a Red-Black tree is O(log n) due to its balanced structure.
Correct Answer:
B
— O(log n)
Learn More →
Q. Which of the following statements is true about AVL trees?
-
A.
They are always complete binary trees.
-
B.
They can have duplicate values.
-
C.
They are more rigidly balanced than Red-Black trees.
-
D.
They require more memory than binary search trees.
Solution
AVL trees are more rigidly balanced than Red-Black trees, which helps in maintaining faster search times.
Correct Answer:
C
— They are more rigidly balanced than Red-Black trees.
Learn More →
Showing 1 to 3 of 3 (1 Pages)