Apex › Storage & databases

Splay tree — the self-adjusting BST

A binary search tree that rebalances around whatever you touch: every lookup rotates that node all the way to the root, so recently- and frequently-accessed keys stay near the top and cost O(1). No balance factors or colors — just "move what you touched up." Click nodes and watch the tree remold itself to your access pattern.

More in Storage & databases