I am currently learning data structure using C++. I understand how you would balance binary search tree as you insert new nodes.
However, what if you already have a degenerate tree(single linklist), and want to balance that without creating a new tree? In conclusion, how would I reassemble the degenerate tree to a complete tree using existing nodes? (USING ROTATION methods)
For example, my nodes hold data of(9 nodes): 1, 3 , 6, 9, 12, 15, 18, 21, 24
I need a push off start for this. Im not sure where to even begin.. I appreciate your help.