Recall & Review
beginner
What is a Binary Search Tree (BST)?
A Binary Search Tree is a tree data structure where each node has at most two children. The left child's value is less than the parent's value, and the right child's value is greater than the parent's value. This property helps in efficient searching, insertion, and deletion.
Click to reveal answer
beginner
What is the main rule to follow when inserting a new value into a BST?
When inserting, compare the new value with the current node's value. If it is smaller, go to the left child; if larger, go to the right child. Repeat this until you find an empty spot where the new value can be inserted as a leaf node.
Click to reveal answer
beginner
Why do we insert new nodes as leaf nodes in a BST?
New nodes are inserted as leaf nodes because the BST property requires that all nodes to the left are smaller and all to the right are larger. Inserting at a leaf maintains this order without disturbing the existing structure.
Click to reveal answer
intermediate
What happens if you try to insert a value that already exists in the BST?
Typically, BSTs do not allow duplicate values. If a duplicate is found during insertion, the process stops or handles it based on specific rules, such as ignoring the insertion or storing duplicates in a special way.
Click to reveal answer
intermediate
How does the insertion operation affect the height of a BST?
Insertion can increase the height of the BST by one if the new node is added at the deepest level. Over many insertions, if values are inserted in sorted order, the BST can become unbalanced and behave like a linked list, increasing height and reducing efficiency.
Click to reveal answer
Where do you insert a new value in a BST if it is smaller than the current node's value?
✗ Incorrect
In a BST, smaller values go to the left subtree to maintain the order property.
What is the first step when inserting a new value into a BST?
✗ Incorrect
Insertion starts by comparing the new value with the root to decide the path.
What happens if you insert values in sorted order into a BST?
✗ Incorrect
Inserting sorted values creates a skewed tree like a linked list, increasing height.
Can a BST contain duplicate values?
✗ Incorrect
Most BSTs do not allow duplicates, but some implementations handle them with special rules.
Where is a new node inserted in a BST?
✗ Incorrect
New nodes are inserted as leaf nodes to maintain BST properties.
Explain the step-by-step process of inserting a new value into a Binary Search Tree.
Think about how you decide where to place the new value by comparing it with existing nodes.
You got /5 concepts.
Describe how inserting values in sorted order affects the shape and efficiency of a BST.
Consider what happens when every new value is always greater than the previous.
You got /4 concepts.