• Finds an element in the splay tree and returns its value

    This is a convenience function that searches for an element and returns just the value if found, or undefined if not found. Like search(), it also splays the accessed node to the root.

    Parameters

    • target: any

      the value to find

    • tree: SplayTree<any>

      the tree to search in

    Returns {
        tree: SplayTree<any>;
        value: any;
    }

    result containing:

    • value: the found value, or undefined if not found
    • tree: the tree after splaying