Q. What is a primary application of AVL trees?
-
A.
Database indexing
-
B.
Memory management
-
C.
File compression
-
D.
Image processing
Solution
AVL trees are commonly used in database indexing due to their efficient search, insert, and delete operations.
Correct Answer:
A
— Database indexing
Learn More →
Q. What is the time complexity for searching an element in a Red-Black tree?
-
A.
O(n)
-
B.
O(log n)
-
C.
O(n log n)
-
D.
O(1)
Solution
Searching for an element in a Red-Black tree takes O(log n) time due to its balanced nature.
Correct Answer:
B
— O(log n)
Learn More →
Q. What is the worst-case time complexity for 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 worst-case 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. What is the worst-case time complexity for deleting a node from an AVL tree?
-
A.
O(n)
-
B.
O(log n)
-
C.
O(n log n)
-
D.
O(1)
Solution
The worst-case time complexity for deleting a node from an AVL tree is O(log n) due to the need to maintain balance.
Correct Answer:
B
— O(log n)
Learn More →
Q. Which of the following is a characteristic of a Red-Black tree?
-
A.
Every node is red
-
B.
Every path from root to leaf has the same number of black nodes
-
C.
All leaves are red
-
D.
The root must be red
Solution
In a Red-Black tree, every path from the root to the leaves must have the same number of black nodes, ensuring balanced height.
Correct Answer:
B
— Every path from root to leaf has the same number of black nodes
Learn More →
Q. Which operation is guaranteed to be O(log n) in an AVL tree?
-
A.
Insertion
-
B.
Deletion
-
C.
Searching
-
D.
All of the above
Solution
All of the operations (insertion, deletion, and searching) in an AVL tree are guaranteed to be O(log n) due to its balanced structure.
Correct Answer:
D
— All of the above
Learn More →
Q. Which operation is not allowed in an AVL tree?
-
A.
Insertion
-
B.
Deletion
-
C.
Traversal
-
D.
Duplicate insertion
Solution
Duplicate insertion is not allowed in an AVL tree as it must maintain unique keys.
Correct Answer:
D
— Duplicate insertion
Learn More →
Q. Which tree structure is more rigidly balanced, AVL or Red-Black?
-
A.
AVL tree
-
B.
Red-Black tree
-
C.
Both are equally balanced
-
D.
Neither is balanced
Solution
AVL trees are more rigidly balanced than Red-Black trees, which allows for faster lookups at the cost of slower insertions and deletions.
Correct Answer:
A
— AVL tree
Learn More →
Showing 1 to 8 of 8 (1 Pages)