mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-24 09:07:14 +00:00
build
This commit is contained in:
@@ -119,7 +119,7 @@ comments: true
|
||||
|
||||
```csharp title="binary_search.cs"
|
||||
/* 二分查找(双闭区间) */
|
||||
int binarySearch(int[] nums, int target) {
|
||||
int BinarySearch(int[] nums, int target) {
|
||||
// 初始化双闭区间 [0, n-1] ,即 i, j 分别指向数组首元素、尾元素
|
||||
int i = 0, j = nums.Length - 1;
|
||||
// 循环,当搜索区间为空时跳出(当 i > j 时为空)
|
||||
@@ -409,7 +409,7 @@ comments: true
|
||||
|
||||
```csharp title="binary_search.cs"
|
||||
/* 二分查找(左闭右开) */
|
||||
int binarySearchLCRO(int[] nums, int target) {
|
||||
int BinarySearchLCRO(int[] nums, int target) {
|
||||
// 初始化左闭右开 [0, n) ,即 i, j 分别指向数组首元素、尾元素+1
|
||||
int i = 0, j = nums.Length;
|
||||
// 循环,当搜索区间为空时跳出(当 i = j 时为空)
|
||||
|
||||
Reference in New Issue
Block a user