Methods
bfs(tree, searchedText, startNode) → {boolean}
Breadth-first search
Parameters:
Name | Type | Default | Description |
---|---|---|---|
tree |
any | tree that needed to search | |
searchedText |
string | text that need to find in tree | |
startNode |
string | start | starting node |
- Source:
Returns:
- is tree contains searchedText
- Type
- boolean
binarySearch(arr, val, start, end) → {Array}
Binary search is an algorithm for finding data in a sorted array in O(log n) time.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
arr |
Array | array of numbers | |
val |
number | value that need to be found | |
start |
number | 0 | start position |
end |
number | end position |
- Source:
Returns:
- sorted array
- Type
- Array
findSmallest(items) → {Array}
Selection sort
Parameters:
Name | Type | Description |
---|---|---|
items |
Array | array of numbers that need to be sorted |
- Source:
Returns:
- sorted array
- Type
- Array
quickSort(arr) → {Array}
Quick sort algorithm
Parameters:
Name | Type | Description |
---|---|---|
arr |
Array | array of numbers that going to be sorted |
- Source:
Returns:
- sorted array
- Type
- Array
Type Definitions
lookUpCallback(leaf)
This callback type is called `lookUpCallback`
Parameters:
Name | Type | Description |
---|---|---|
leaf |
any | of the value that has been found |