new binarySearchTree(default) → {Object}
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
default |
object | default node
Properties
|
Returns:
- binary search tree instance
- Type
- Object
Methods
(inner) createBasicStructure(default)
creates default BST leaf
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
default |
object | default BST data
Properties
|
(inner) get()
Returns:
BST structure
(inner) insert(value)
inserts value to a BST
Parameters:
Name | Type | Default | Description |
---|---|---|---|
value |
any | null |
Returns:
inserted value
(inner) isLeaf(value)
Parameters:
Name | Type | Description |
---|---|---|
value |
any |
Returns:
if value is a leaf
(inner) lookUp(value, fn)
maps over data and returns founded value's leaf to cb function
Parameters:
Name | Type | Description |
---|---|---|
value |
any | the value that needed to be found |
fn |
lookUpCallback |
(inner) search(value)
Parameters:
Name | Type | Description |
---|---|---|
value |
any |
Returns:
wheter BST has value or not