MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / main

Function main

CPP/searching/binary_search1.cpp:46–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44
45
46int main(){
47 cin.tie(0)->sync_with_stdio(0);
48 int n;
49 cin>>n;
50 vector<int> arr(n);
51 for (int &val : arr) {
52 cin >> val;
53 }
54 int key;
55 cin>>key;
56 cout<<"first occurrence is :"<<firstocc(arr,n,key);
57
58 cout<<"last occurrence is :"<<lastocc(arr,n,key);
59 return 0;
60}
61
62

Callers

nothing calls this directly

Calls 2

firstoccFunction · 0.85
lastoccFunction · 0.85

Tested by

no test coverage detected