update sequence

This commit is contained in:
ranwenjie
2021-09-13 11:36:49 +08:00
parent adad6993cc
commit d1ad2f3dbb
10 changed files with 110 additions and 25 deletions
+15
View File
@@ -36,6 +36,21 @@ int binary_search(int *a,int length,int k){
}
```
```
注意细节
```
如果搜索有序数列是 `[1,2,2,2,2,3]` 这种,想得到 target 的左侧边界,即索引 1,或者我想得到 target 的右侧边界,即索引 4 ; 这时候怎么处理呢?
## 分块查找
块内无序,块之间有序;可以先二分查找定位到块,然后再到块中顺序查找。