All topics
73

The left rotation: fixing a right-heavy node

Tier 1Locked

Where it runs

1. The problem

Step 72 taught you to name the break. You look at a node whose balance factor left [-1, 1] and say which of the four shapes you have: LL, LR, RL or RR. But naming it has not moved a single pointer. In this lesson you repair the simplest shape, RR (right-heavy). It is also the most common one. Insert values in increasing order (1, 2, 3, timestamps, IDs that a database hands out in order), and each new value goes to the right of the previous one. The tree stretches into a chain that leans to the right. This tilt is fixed by one move: a single left rotation.

This step is part of the paid track

The first 33 steps are open to everyone: lesson, exercise and tests. This one opens with full access. Start with a free account and the free steps.

Create a free accountSee what is included

On LeetCode

No LeetCode problem asks for a left rotation on its own. A rotation is one part of the AVL insert and delete, and LeetCode only sees the finished tree. The full AVL tree comes together in lessons 76 and 77, and those lessons list the problems it solves.

We use necessary cookies to run the site (sign-in and language). If you accept, we also load Google Analytics to see which pages are used, and Google reCAPTCHA to keep spam off the contact and bug-report forms. Privacy policy