DSA Lab
Binary search tree
A binary search tree keeps one rule at every node: everything in its left subtree is smaller, everything in its right subtree is larger. That rule turns every search into a single path from the root down.
Binary search tree: how it works
In this tool: insert, delete, search, traversals. Put in your own values and watch it change. Each operation runs one step at a time and says in plain words what happened, with its calculation worked out. The code is shown in Python, C, C++ or Java with the line that just ran marked, and an Understand it panel gives the idea, why it works, the cost of each operation, common mistakes and a short quiz.
Lessons that use it
- Binary trees (Python)Build trees of nodes with left and right children, and solve tree problems with recursion.
- Binary trees (Data Structures)Nodes with left and right children, preorder, inorder and postorder traversal, and recursive height and count.
- Binary search trees (Data Structures)Smaller keys to the left, larger to the right: insert, search, and delete with its three cases.
- Tree patterns (Interview Prep)Recursive depth-first answers built from the children's answers, breadth-first level order with a queue, validating a binary search tree, and the lowest common ancestor.