# Splay Tree Rotations

Splay trees are binary search trees which are self-adjusted in which every operation on the element rearranges the trees so that, the element is placed at the root position of the tree

In a splay tree, every operation is performed at the root of the tree

all the operations in a splay tree are involved with the common operating called splaying

## Splaying

Splaying an element is the process of bringing the element to the root position by performing the suitable rotation operation

by splaying the elements closure to the root of the tree.so that, any operation on those elements is performed quickly i.e splaying operation automatically brings more frequently used elements to the root of the tree

Rotations of the splay trees

1. Zig Rotation
2. Zag Rotation
3. Zig-Zig Rotation
4. Zag-Zag Rotation
5. Zig-Zag Rotation
6. Zag-Zig Rotation

### Zig Rotation

Zig rotation in splay tree is similar to single R rotation in AVL trees in AVL tree. In this rotation, every node moves one position to the right from the current position

### Zag Rotation

Zag rotation in the splay tree is similar to single L rotation in AVL trees .in this rotation every node moves one position to the left from the current position

### Zig-Zig Rotation

In this rotation of splay trees is the double zig rotation in which every node moves two positions to the right from its current position

### Zag-Zag Rotation

In this rotation in the splay tree the double zag rotation in which every node moves two positions left to form its current position

### Zig-Zag Rotation

In this rotation of splay tree is the sequence of zig rotation followed by zag rotation.

In zig-zag rotation, every node moves one position to the right followed by one position to the left from its current position

### Zag-Zig Rotation

In this rotation of splay tree is the sequence of zag rotation followed by zig rotation.

In zig-zag rotation, every node moves one position to the left followed by one position to the right from its current position

##### Vishal Devxo
Vishal Devxo is a DevOps engineer and a Backend developer, he spends all his time for creating good tutorials with better visuals and blogging, developed some projects based on Python-Django, some hacking modules and scripts in python