0

If we had, say, nodes of value 10, 9 ... 1 arranged in descending order on a single left branch, how could we perform rotations on the tree to make it a balanced AVL tree? I was thinking of repeating single right rotations, but could someone show the sequence of steps here?

Y. P
  • 9
  • 3
  • You can reverse the single left branch tree to create a single right branch tree (called a vine), then convert vine to tree. Link to [rebalance tree.pdf](http://web.eecs.umich.edu/~qstout/pap/CACM86.pdf) . – rcgldr Oct 02 '17 at 19:27

1 Answers1

2

Do rotations at the root until 5 is at the top. The tree is now an upside down V. Now do a similar operation on each of the two subtrees and so on.

Henry
  • 42,982
  • 7
  • 68
  • 84