22 Lecture
CS301
Midterm & Final Term Short Notes
Cases of rotations
Rotations in a binary search tree are used to maintain balance and ensure efficient operations. There are two types of rotations: left rotations and right rotations. Each type of rotation has two cases: single rotations and double rotations. Sin
Important Mcq's
Midterm & Finalterm Prepration
Past papers included
Download PDF
Which of the following is not a type of rotation in a binary search tree? A. Left rotation B. Right rotation C. Upward rotation D. Double rotation Answer: C
When is a single left rotation used in a binary search tree? A. When the imbalance occurs in the immediate left child B. When the imbalance occurs in the immediate right child C. When the imbalance occurs in the grandchild of the left child D. When the imbalance occurs in the grandchild of the right child Answer: A
Which of the following is a case of double rotation in a binary search tree? A. Left-Left case B. Left-Right case C. Right-Left case D. Right-Right case Answer: B
In a left-right double rotation, what is the first step performed? A. A single left rotation on the right child B. A single right rotation on the left child C. A double right rotation on the left child D. A double left rotation on the right child Answer: B
Which of the following is not a benefit of rotations in a binary search tree? A. Maintaining balance B. Ensuring efficient search operations C. Reducing the height of the tree D. Increasing the height of the tree Answer: D
What is the maximum number of rotations required to balance a node in a binary search tree? A. 1 B. 2 C. 3 D. 4 Answer: B
When is a single right rotation used in a binary search tree? A. When the imbalance occurs in the immediate left child B. When the imbalance occurs in the immediate right child C. When the imbalance occurs in the grandchild of the left child D. When the imbalance occurs in the grandchild of the right child Answer: B
Which of the following is a case of single rotation in a binary search tree? A. Left-Left case B. Left-Right case C. Right-Left case D. Right-Right case Answer: A
In a left-left single rotation, what is the new root of the subtree? A. The left child of the original root B. The right child of the original root C. The parent of the original root D. The original root itself Answer: A
Which of the following is a disadvantage of using rotations in a binary search tree? A. Increased tree height B. Reduced search efficiency C. Increased complexity D. None of the above Answer: D
Subjective Short Notes
Midterm & Finalterm Prepration
Past papers included
Download PDF
What is a rotation in a binary search tree? Answer: A rotation is a manipulation performed on a binary search tree to maintain its balance.
What are the two types of rotations in a binary search tree? Answer: The two types of rotations are single rotations and double rotations.
How do rotations help in balancing a binary search tree? Answer: Rotations help in redistributing the nodes of a binary search tree to maintain balance, which in turn helps in efficient search operations.
When is a single left rotation used in a binary search tree? Answer: A single left rotation is used when the imbalance occurs in the immediate left child of a node.
When is a single right rotation used in a binary search tree? Answer: A single right rotation is used when the imbalance occurs in the immediate right child of a node.
What is the difference between a single rotation and a double rotation in a binary search tree? Answer: A single rotation involves rotating only one node, while a double rotation involves rotating two nodes.
What is the maximum number of rotations required to balance a node in a binary search tree? Answer: The maximum number of rotations required to balance a node in a binary search tree is two.
What is the left-right case in a binary search tree rotation? Answer: The left-right case occurs when the left child of a node has a right child, and the subtree is imbalanced.
What is the right-left case in a binary search tree rotation? Answer: The right-left case occurs when the right child of a node has a left child, and the subtree is imbalanced.
What is the purpose of using rotations in a binary search tree? Answer: The purpose of using rotations in a binary search tree is to maintain its balance and ensure efficient search operations.