LOGBOOK

HELP

Quiz Entry - updated: 2026.12.01

In the same composer AVL tree, Schumann has a single right child, Telemann. What happens when Zelenka is inserted?

Zelenka sorts after every other name and becomes Telemann's right child. Schumann gets balance factor −2: z = Schumann, y = Telemann, x = Zelenka, a right-right line. A single left rotation around Schumann makes Telemann the subtree root with Schumann and Zelenka as its children.

Search: Zelenka > Mozart, > Schubert, > Schumann, > Telemann, so it is attached as Telemann's right child.

Balance factors, walking up:

Node Left height Right height Balance
Telemann −1 0 −1
Schumann −1 1 −2: z
Schubert 0 (Schostakowitsch) 2 −2, higher up

Schubert is out of balance too, but the repair starts at the lowest violation, Schumann.

Single left rotation around Schumann: Telemann rises into Schumann's place as Schubert's right child, Schumann becomes Telemann's left child and Zelenka stays its right child. Telemann's subtree now has height 1 again, the height Schumann's subtree had before the insert, so Schubert returns to −1 and Mozart to +1 without being touched.

From Quiz: ADS / AVL Trees and Splay Trees | Updated: Dec 01, 2026