Skip to content

RandBinarySearchTree ​

ts
new RandBinarySearchTree<T>(compare?);

compare(current, value) means current belongs to the right of value when it returns true. undefined sorts before finite numbers, and NaN sorts after them, when the comparator does not order the pair.

subtree returns another RandBinarySearchTree and keeps compare.

See /guide/data-structures/binary-tree-rand.

MIT Licensed