![]() |
VOOZH | about |
Given an array of integers, the task is to find the sequence in which these integers should be added to an AVL tree such that no rotations are required to balance the tree.
Examples :
Input : array = {1, 2, 3}
Output : 2 1 3
Input : array = {2, 4, 1, 3, 5, 6, 7}
Output : 4 2 6 1 3 5 7
Approach :
Below is the implementation of the above approach :
4 2 6 1 3 5 7
Complexity Analysis: