guess the next step: AVL tree
Before each step plays, guess what it does. The page then shows the step as the run takes it and says why, the same sentence the watch page says there.
Step 10 of 45
Question 7 of 36
Step 10 of 45
Step 11 of 45
Step 12 of 45
Step 13 of 45
Step 14 of 45
Step 15 of 45
Step 16 of 45
Step 17 of 45
Question 7 of 36
Question 7 of 36
Right.
You guessed: At 20, the two sides differ by one level at most.
What the run did:
At 20, the left side is empty and the right side one level high, so it is balanced.
Question 7 of 36
Not this time.
You guessed: At 20, one side is two levels higher, so the tree must turn.
What the run did:
At 20, the left side is empty and the right side one level high, so it is balanced.
Question 8 of 36
Question 8 of 36
Not this time.
You guessed: At 10, the two sides differ by one level at most.
What the run did:
At 10, the left side is empty and the right side 2 levels high: two levels apart, so the tree must turn.
Question 8 of 36
Right.
You guessed: At 10, one side is two levels higher, so the tree must turn.
What the run did:
At 10, the left side is empty and the right side 2 levels high: two levels apart, so the tree must turn.
Question 9 of 36
Question 9 of 36
Right.
You guessed: Turn left at 10.
What the run did:
Turn left at 10: 20 moves up into its place, and 10 hangs to its left.
Question 9 of 36
Not this time.
You guessed: Turn right at 10.
What the run did:
Turn left at 10: 20 moves up into its place, and 10 hangs to its left.
Question 10 of 36
Question 10 of 36
Not this time.
You guessed: 40 is smaller than 20, so go left.
What the run did:
40 is bigger than 20, so go right.
Question 10 of 36
Right.
You guessed: 40 is bigger than 20, so go right.
What the run did:
40 is bigger than 20, so go right.
Question 11 of 36
Question 11 of 36
Not this time.
You guessed: 40 is smaller than 30, so go left.
What the run did:
40 is bigger than 30, so go right.
Question 11 of 36
Right.
You guessed: 40 is bigger than 30, so go right.
What the run did:
40 is bigger than 30, so go right.
Question 12 of 36
Question 12 of 36
Not this time.
You guessed: Hang 40 to the left of 30.
What the run did:
The way runs out, so hang 40 to the right of 30.
Question 12 of 36
Right.
You guessed: Hang 40 to the right of 30.
What the run did:
The way runs out, so hang 40 to the right of 30.