Also called Self-balancing binary search tree and Adelson-Velsky and Landis tree.
fresh numbers
The test's questions that a run answers, asked again on new numbers whenever you like. The answer, its working and the reason for every other choice come from avl tree's own run on the numbers shown.
choose one
1question 1
An empty AVL tree puts in 88, 55, 47, 23 and 11, in that order. How many comparisons do the five puts make in all?
the answer, and why
the answer is D
88 is the top, 0. 55 meets 88, 1. 47 meets 88 and 55, 2, then turn right at 88: 55 moves up. 23 meets 55 and 47, 2. 11 meets 55, 47 and 23, 3, then turn right at 47. That is 8.
if you chose another
AThat is the plain tree's count. With no turns, each number meets every number before it.
BThat is middle first's, the cheapest order of five; here 47 meets 88 and 55 before the tree turns.
CThat counts one comparison a put, but later puts go deeper.