Search Tree Rotation: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 5: Line 5:
* [[Binary_Search_Trees#Rotation|Binary Search Trees]]
* [[Binary_Search_Trees#Rotation|Binary Search Trees]]
=Overview=
=Overview=
Rotations are a set of primitives common to all binary search tree implementations, which preserve the [[Binary_Search_Trees#Binary_Search_Tree_Property|Binary Search Tree Property]].
Rotations are a set of primitives common to all binary search tree implementations, which preserve the [[Binary_Search_Trees#Binary_Search_Tree_Property|Binary Search Tree Property]] while locally rebalancing subtrees at a node in O(1) time. There are left rotations and right rotations. When invoking a rotation, is on a parent-child pair of a search tree. If it is the right child of the parent, use a left rotation. If it is the left child, use a right rotation.

Revision as of 18:41, 13 October 2021

External

Internal

Overview

Rotations are a set of primitives common to all binary search tree implementations, which preserve the Binary Search Tree Property while locally rebalancing subtrees at a node in O(1) time. There are left rotations and right rotations. When invoking a rotation, is on a parent-child pair of a search tree. If it is the right child of the parent, use a left rotation. If it is the left child, use a right rotation.