4.37. kink/container/TREE_SET¶
Provides an ordered_set implementation which stores all the elements in a balanced binary tree.
This implementation can be a safe default choice, because it guarantees logarithmic worst-case computational complexity for .push and .remove methods.
Worst-case computational orders of each operations are as follows:
* have?: O(log N)
* push: O(log N)
* remove: O(log N)
* size and empty?: O(1)
Where N is the size of the set.
4.37.1. TREE_SET.of(... Elems)¶
Makes a tree set with the natural ordering, containing Elems.
In the natural ordering, X precedes Y if and only if X < Y.
4.37.2. TREE_SET.from_each(Eacher)¶
`from_each` makes a tree set with the natural ordering, containing each element of the `Eacher`.
In the natural ordering, X precedes Y if and only if X < Y.
4.37.3. TREE_SET.new(...[$config = {}])¶
Makes an empty ordered_set with the tree set implementation.
$config must take a Config as a param. The Config val has the following method.
Config.precede_fun($_precede?): sets $_precede? to be used to determine the strict weak ordering of elems. $_precede? must take two parameters, and returns true if the first parameter precedes the second one in the ordering, or false otherwise.
If Config.precede_fun is not called, the natural ordering is used.