It is a self-adjusting binary search tree with an additional property that the recently accessed key/element becomes the root node.
Not a strictly balanced binary search tree: this means that its worst case time for some operation when amortized is
We always perform an operation, and then we splay the tree; that is, we perform rotations after every insertion, deletion or search to make the recently accessed key the new root node.
- ZIG: right rotation
- ZAG: left rotation
- You also have zig-zig, zag-zag, zig-zag and zag-zig. For a search or insertion, the element itself is made the root. For a deletion, the previous element accessed while searching for the element is made the root.