Questions tagged [tree-rotation]

Tree rotation is an operation on a binary tree that changes the structure without interfering with the order of the elements.

Tree rotation is an operation on a binary tree that changes the structure without interfering with the order of the elements. A tree rotation moves one node up in the tree and one node down. It is used to change the shape of the tree, and in particular to decrease its height by moving smaller subtrees down and larger subtrees up, resulting in improved performance of many tree operations.

17 questions
0
votes
1 answer

Rotation distance between two binary trees

I have the following binary tree, which I'm trying to convert into the target binary tree (second tree in the post) using minimum number of tree rotations. The theoretical minimum number of rotations for this tree is 5, however, the smallest value I…
Zahaib Akhtar
  • 1,068
  • 2
  • 11
  • 26
0
votes
1 answer

How to create the bottom up splay tree from the following sequence

This is the sequence 20,10,5,30,40,57,3,2,4,35,25,18,22,27 I've tried it by making every new inserted node as the root but it's not working. Can anybody give me step by step explanation?
1
2