MCPcopy Create free account
hub / github.com/Seogeurim/CS-study / search

Function search

contents/algorithm/code/LDS_bs.cpp:9–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7int LDS[1001];
8
9int search(int start, int end, int target){
10 int ans;
11
12 while(start <= end){
13 int mid = (start + end) / 2;
14
15 if(LDS[mid] <= target){
16 ans = mid;
17 end = mid - 1;
18 }
19 else
20 start = mid + 1;
21 }
22
23 return ans;
24}
25
26int main(void){
27 ios::sync_with_stdio(false);

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected