makeRedBlackTree (RedBlackTree)

makeRedBlackTree ( range -- tree )

Creates a tree from a range of pairs (key value), all entries will be aliased.

makeRedBlackTree ( builtinList -- tree )

Creates a tree from a builtin-list of pairs (key value), all entries will be aliased.

Arguments

makeRedBlackTree ( range -- tree )

range
of (key value) pairs (see Range).

makeRedBlackTree ( builtinList -- tree )

list
is a builtin-list (key value) pairs.

Return values

tree
is the resulting RedBlackTree.

Complexity

O(size*log(size))

Example

"sl/array" useFile "sl/redBlackTree" useFile rb1: ((1 "ONE") (3 "THREE") (2 "TWO")) makeRedBlackTree; a1: ((1 "ONE") (3 "THREE") (2 "TWO")) makeArray; rb2: a1.makeRange makeRedBlackTree copy; rb1 [print "," print TRUE] enum LF print a1 [print "," print TRUE] enum LF print rb2 [print "," print TRUE] enum
Output:
{ key: 1; value: "ONE"; },{ key: 2; value: "TWO"; },{ key: 3; value: "THREE"; }, ( 1 "ONE" ),( 3 "THREE" ),( 2 "TWO" ), { key: 1; value: "ONE"; },{ key: 2; value: "TWO"; },{ key: 3; value: "THREE"; },