Tree A
First insertion becomes the root
Data Structures / Visual Lab
A binary search tree stores keys in a strict left/right order, but an ordinary BST does not rotate or rebalance itself. Insertion order changes the shape it creates.
First insertion becomes the root
Only the insertion order changes
The first key is the root. Each later key walks left when it is smaller, right when it is larger, and occupies the first empty position on that path. Duplicates are ignored in this ordinary BST.
A poor early root can split the remaining keys into one long side. A later key then travels through every earlier ancestor before finding its position, increasing the tree's path lengths.
These are plain BSTs: there are no AVL or Red-Black rotations. The shallow tree is shallow because of its insertion order, not because the data structure repaired itself.