Less than 1 minute
Home > @hz-9/algorithm > redBlackTreeSearch
redBlackTreeSearch() function
Sequential search algorithm.(RedBlackTree) Input parameters do not need to be sorted.
线性搜索算法。(红黑树) 传入参数必须已经进行从小到大排序。
Signature:
redBlackTreeSearch: <T>(list: T[], value: T, compareFn?: CompareFn<T>) => numberParameters
Parameter | Type | Description |
|---|---|---|
list | T[] | The list to search. |
value | T | The value to search for. |
compareFn | CompareFn<T> | (Optional) The compare function. |
Returns:
number
- The index of the value in the list. If the value is not found, return -1.