常用算法集合
二分查找int binary_search(const int arr[], int start, int end, int key){ int res = -1; int mid; while(start <= end){ mid = begin + (end - begin) / 2; if(arr[mid] == key){ res = mid; return res; } else if(arr[mid] < key) start = mid
原创
2021-07-31 20:03:17 ·
67 阅读 ·
0 评论