Q. What is the primary purpose of using AVL trees in real-world applications?
A.
To store data in a sorted manner
B.
To allow faster search operations
C.
To maintain balance for efficient operations
D.
To reduce memory usage
Solution
AVL trees maintain balance through rotations, ensuring that operations like search, insert, and delete remain efficient with a time complexity of O(log n).
Correct Answer:
C
— To maintain balance for efficient operations
Q. Which of the following statements about AVL and Red-Black trees is true?
A.
AVL trees are always faster than Red-Black trees
B.
Red-Black trees are more memory efficient than AVL trees
C.
AVL trees provide faster lookups than Red-Black trees
D.
Both trees are equally efficient in all scenarios
Solution
AVL trees provide faster lookups than Red-Black trees due to their stricter balancing, but Red-Black trees are generally more efficient for insertions and deletions.
Correct Answer:
C
— AVL trees provide faster lookups than Red-Black trees