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

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

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

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

    Parameters

    • tree: SplayTree<any>

      the tree to rotate (P in the diagram)

    Returns SplayTree<any>

    the new root after rotation (C in the diagram)