Say i have a unordered set s{3,6,5,1,2,4} and i need to construct an AVL tree,
this much is fine... i understand basic rotations and i get to this point here:
5
/ \
2 6
/ \
1 3
but it all falls apart when i try to insert 4 and i get my final answer as (the left one)
4 But the actual answer is: 3
/ \ / \
2 5 2 5
/ \ \ / / \
1 3 6 1 4 6
And when i break it down i get stuck doing the same rotation
so im asking how do i do a rotation with the parent that is valid for this AVL?
and is my solution valid?