Methods
get(key) → {Object}
Get value by the given key.
Complexity: O(log N).
Complexity: O(log N).
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).
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).
Complexity: O(log N).
Parameters:
Name | Type | Description |
---|---|---|
key |
Number
|
Key. |
value |
Object
|
Value. |