LOGBOOK

HELP

Quiz Entry - updated: 2026.11.26

Why is a single restructuring $O(1)$, and what assumption does that rely on?

Because in a linked tree it only rewires a constant number of references (parent, left and right pointers of three nodes and the roots of four subtrees), however large those subtrees are. In an array-based tree it would not be: moving a subtree means copying every node in it to new indices.

A rotation looks like it moves whole subtrees, but in a linked structure a subtree is just one reference to its root. Moving T2 from y to z means changing T2's parent pointer and one child pointer, whether T2 holds three nodes or three million.

The array layout (node at index $i$, children at $2i$ and $2i+1$) ties every node's position to its place in the tree. A rotation changes the depth of entire subtrees, so every node in them would need a new index: $O(n)$ copying for one rotation.

That is why balanced search trees are built from linked nodes, while the array layout is kept for structures that never rotate, such as the heap, which stays complete by construction.

From Quiz: ADS / AVL Trees and Splay Trees | Updated: Nov 26, 2026