RBTree

data-structures/red-black-tree. RBTree

new RBTree()

Red-Black Tree.
Source:

Methods

get(key) → {Object}

Get value by the given key.

Complexity: O(log N).
Source:
Parameters:
Name Type Description
key Number A key to be searched for.
Returns:
Type:
Object
A value which will be returned based on the key.

levelOrderTraversal() → {String}

Get Level Order Traversal for the given Red Black Tree, returns 'Tree is empty' string when tree has no Nodes. Complexity: O(N).
Source:
Returns:
Type:
String
The keys of the tree in level order traversal.

put(key, value)

Add value associated with a given key.

Complexity: O(log N).
Source:
Parameters:
Name Type Description
key Number Key.
value Object Value.