0
0
DSA Typescriptprogramming~5 mins

BST Property and Why It Matters in DSA Typescript - 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 for searching?
Because the BST property keeps smaller values to the left and larger to the right, it allows fast searching by deciding which subtree to explore next, reducing the search space quickly.
Click to reveal answer
beginner
How does the BST property help in inserting a new value?
When inserting, the BST property guides where to place the new value by comparing it with nodes, moving left if smaller or right if larger, ensuring the tree stays ordered.
Click to reveal answer
intermediate
What happens if the BST property is violated?
If the BST property is broken, searching and inserting become inefficient because the tree loses its order, possibly turning into a list and slowing operations to linear time.
Click to reveal answer
beginner
Explain the BST property using a real-life example.
Think of a phone book sorted by names: all names starting with A come before B, and so on. This order helps you quickly find a name by skipping large sections, just like BST property helps find values fast.
Click to reveal answer
What must be true for every node in a BST?
AAll values in left and right subtrees are equal
BLeft subtree values are larger, right subtree values are smaller
CLeft subtree values are smaller, right subtree values are larger
DNo specific order is required
Why does the BST property improve search speed?
AIt stores values randomly
BIt allows skipping half of the tree at each step
CIt duplicates values for faster access
DIt uses a queue to find values
If a new value is smaller than a node's value, where should it go in a BST?
ALeft subtree
BRight subtree
CAt the node itself
DAnywhere in the tree
What is a consequence of violating the BST property?
ASearch and insert become slower
BTree becomes balanced automatically
CValues get sorted faster
DNo effect on operations
Which real-life example best illustrates the BST property?
AA shuffled deck of cards
BA pile of unsorted papers
CA random list of names
DA sorted phone book
Describe the BST property and explain why it is important for efficient searching.
Think about how the tree guides you to find values quickly.
You got /5 concepts.
    Explain what could happen if the BST property is not maintained in a tree.
    Consider how the tree's structure affects speed.
    You got /4 concepts.