• Checks if an element exists in the splay tree

    This is a convenience function that searches for an element and returns just a boolean indicating whether it was found. Like search(), it also splays the accessed node to the root.

    Parameters

    • target: any

      the value to check for

    • tree: SplayTree<any>

      the tree to search in

    Returns {
        contains: boolean;
        tree: SplayTree<any>;
    }

    result containing:

    • contains: true if target exists in tree, false otherwise
    • tree: the tree after splaying