BST to AVL in O(n)

Hi guys! I hope this is the right place to post this question. I found in different places on the internet how to turn a Binary Search Tree into an AVL tree in O(nlog(n)). I was wondering how can this be done in O(n) (as the worst case limit). It kinda seems possible with right rotations but I just don't know how to implement it exactly. Any idea is welcomed!
Thank you!
Topic archived. No new replies allowed.