I am trying to wrap my brain around how to write code to rotate a binary tree. I looked at http://en.wikipedia.org/wiki/Tree_rotation and enfuzzled.com I looked at this for 2 hours and looked at it several times earlier. I still see problems in the wikipedia article and cannot fully understand the other, for example.
Both of these lines mentioned in the wikipedia article cannot be true right away.
Let P be Q left child. Set P as the new root.
Can anybody help? thanks
source share