rotate tree clockwise
if the following are true:
- find root index in tree = ri
- the element at index ri of stack tree = node (root_val, left, right)
- the element at index left of stack tree = node (l_val, l_left, l_right)
then result of rotating tree clockwise = result of storing (node (l_val, l_left, ri)) at index left of stack (result of storing (node (root_val, l_right, right)) at index ri of stack tree)
Comments
Please log in to add comments