contains

fun <T> TreeNode<T>.contains(value: T): Boolean(source)

Returns true when this subtree contains a node whose value equals value, including the receiver itself. Values are compared with == (equals).

Return

true if any node in the pre-order traversal of this subtree holds value.

Runs in O(n) time over the n nodes of this subtree and stops at the first match.

Parameters

value

the value to search for.