Image for Tree rotation

Tree rotation

Tree rotation is a method used to adjust the structure of a tree data structure, often to improve efficiency. Think of it like reorganizing a family tree to balance the branches, making it easier to find or manage members. When certain parts of the tree become too heavy on one side (unbalanced), rotation moves nodes around—either lifting a branch and placing it on the other side or shifting parts of the tree—to achieve better symmetry. This reorganization helps keep operations like searching, inserting, or deleting data quick and efficient.