0
0
DSA Javascriptprogramming~5 mins

BST Property and Why It Matters in DSA Javascript - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the BST property?
In a Binary Search Tree (BST), for every node, all values in its left subtree are smaller, and all values in its right subtree are larger than the node's value.
Click to reveal answer
beginner
Why does the BST property matter?
It allows fast searching, insertion, and deletion because we can decide to go left or right at each node, reducing the search space quickly.
Click to reveal answer
intermediate
What happens if the BST property is violated?
The tree no longer guarantees efficient search operations, and it behaves like a regular binary tree, losing the speed advantage.
Click to reveal answer
beginner
How does the BST property help in searching for a value?
At each node, compare the target value with the node's value. If smaller, go left; if larger, go right. This halves the search space each step.
Click to reveal answer
intermediate
Can a BST have duplicate values? How does the property handle them?
Usually, BSTs do not allow duplicates or store duplicates consistently (e.g., all duplicates go to the right). The property must be maintained to keep order.
Click to reveal answer
What does the BST property ensure about the left subtree of a node?
AAll values are smaller than the node's value
BAll values are larger than the node's value
CValues can be any number
DAll values are equal to the node's value
Why is the BST property important for search operations?
AIt makes the tree balanced automatically
BIt stores values in random order
CIt allows skipping half of the tree at each step
DIt prevents insertion of new nodes
If a node's value is 10, which subtree can contain the value 15?
ALeft subtree
BNone
CEither subtree
DRight subtree
What happens if the BST property is broken?
ATree becomes balanced
BSearch becomes slower
CInsertion is faster
DTree becomes empty
How are duplicates usually handled in a BST?
ADuplicates are not allowed or placed consistently (e.g., always right)
BDuplicates go to the left subtree
CDuplicates replace the node
DDuplicates are ignored
Explain the BST property and how it helps in searching for a value.
Think about how you decide which way to go when searching.
You got /4 concepts.
    Describe what happens if the BST property is violated and why it matters.
    Consider the impact on search speed.
    You got /3 concepts.