Which of the following best describes the Binary Search Tree (BST) property?
Think about how the tree helps you find values quickly by comparing with the current node.
The BST property ensures that for each node, all values in the left subtree are smaller, and all values in the right subtree are larger. This allows efficient searching.
Which invariant must be maintained after inserting a new value into a BST?
Focus on what property defines a BST regardless of shape.
After insertion, the BST property must hold so that searching remains efficient. Balancing or leaf depth equality is not guaranteed in a basic BST.
Given the following tree structure, which node violates the BST property?
10
/ \
5 15
/ \ \
2 12 20Check if all nodes in the left subtree are less than 10 and all in the right subtree are greater than 10.
The node with value 12 is in the left subtree of 10 but is greater than 10, violating the BST property.
Which statement correctly distinguishes a Binary Search Tree (BST) from a general Binary Tree?
Think about the ordering rules that make searching efficient.
A BST has a strict ordering rule for left and right children, unlike a general Binary Tree which has no ordering constraints.
If a node in a BST violates the BST property, what is the most likely consequence when searching for a value?
Consider how the search algorithm relies on the BST property to decide which subtree to explore.
If the BST property is violated, the search may go down the wrong path and miss the target value even if it is present.