• Performs a single right rotation (also called "zig" when moving left child up)

    This is the fundamental building block of splay operations. In splay tree terminology:

    • When splaying a left child to root, this is called a "zig" operation
    • This rotation is also used in "zig-zig" (double right) and "zig-zag" patterns

    Transforms: P C / \ -> /
    C Z X P / \ /
    X Y Y Z

    Parameters

    • tree: SplayTree<any>

      the tree to rotate (P in the diagram)

    Returns SplayTree<any>

    the new root after rotation (C in the diagram)