zerohertzLib.algorithm.bisect ¶
Functions:
| Name | Description |
|---|---|
bisect_left | Binary Search (left) |
bisect_right | Binary Search (right) |
bisect_left ¶
Binary Search (left)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sorted_list | list[int | float] | 정렬된 list | required |
value | int | float | 찾고자하는 값 | required |
Returns:
| Type | Description |
|---|---|
int |
|
Examples:
>>> zz.algorithm.bisect_left([1, 3, 5], 2.7)
1
>>> zz.algorithm.bisect_left([1, 3, 5], 3)
1
>>> zz.algorithm.bisect_left([1, 3, 5], 3.3)
2
Source code in zerohertzLib/algorithm/bisect.py
bisect_right ¶
Binary Search (right)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sorted_list | list[int | float] | 정렬된 list | required |
value | int | float | 찾고자하는 값 | required |
Returns:
| Type | Description |
|---|---|
int |
|
Examples:
>>> zz.algorithm.bisect_right([1, 3, 5], 2.7)
1
>>> zz.algorithm.bisect_right([1, 3, 5], 3)
2
>>> zz.algorithm.bisect_right([1, 3, 5], 3.3)
2