• Deletes an element from the splay tree

    Follows the standard splay tree deletion algorithm:

    1. Splay the target element to the root
    2. If element doesn't exist, return the splayed tree (element was not found)
    3. If element exists at root:
      • If no left subtree, return right subtree
      • If no right subtree, return left subtree
      • Otherwise, find max in left subtree, splay it to root of left subtree, then make right subtree its right child

    Parameters

    • value: any

      the value to delete

    • tree: SplayTree<any>

      the tree to delete from

    Returns SplayTree<any>

    the new tree with the element deleted (if it existed)