(self, parent_node: Node, child_index: int)
Take key from left brother of the child and transfer to the child
Take key from left brother of the child and transfer to the child
Take key from left brother of the child and transfer to the child
def _rotate_right(self, parent_node: Node, child_index: int):
        """
        Take key from left brother of the child and transfer to the child
        """
        parent_key = parent_node.keys[child_index - 1]
        new_parent_key = parent_node.children[child_index - 1].keys.pop()
        parent_node.children[child_index].keys.insert(0, parent_key)
        parent_node.keys[child_index - 1] = new_parent_key

        if not parent_node.children[child_index - 1].is_leaf:
            ownerless_child = parent_node.children[child_index - 1].children.pop()
            # make ownerless_child as a new lowest child (with lowest key) -> transfer from left subtree to right subtree
            parent_node.children[child_index].children.insert(0, ownerless_child)
def _rotate_right ( self , parent_node : Node , child_index : int ) : parent_key = parent_node . keys [ child_index - 1 ] new_parent_key = parent_node . children [ child_index - 1 ] . keys . pop ( ) parent_node . children [ child_index ] . keys . insert ( 0 , parent_key ) parent_node . keys [ child_index - 1 ] = new_parent_key if not parent_node . children [ child_index - 1 ] . is_leaf : ownerless_child = parent_node . children [ child_index - 1 ] . children . pop ( ) # make ownerless_child as a new lowest child (with lowest key) -> transfer from left subtree to right subtree parent_node . children [ child_index ] . children . insert ( 0 , ownerless_child )