i was wondering how can i convert a BST to an avl in O(nlogn) time if every node of the BST is:
struct node{
int leftHeight;
int rightHeight;
struct node* lr;
struct node* rc;
}
Do i have to visit every node of the bst to check if the balance is different than 0,1, -1? And if so i have to check if it's a right or left child so that i will perform left or right rotation respectively? How do i do that?
I'm using C. Please don't judge me i'm a beginner.