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

Function main

CPP/searching/binary_search.cpp:27–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25#endif
26 }
27 int main() {
28 initial();
29 int arr[] = {10, 13, 15, 16, 19, 30, 34, 45, 65, 34};
30 int key;
31 cin >> key;
32 int n = sizeof(arr) / sizeof(int);
33 int index = bin(arr, n, key);
34 if (index != -1) {
35 cout << key << " is present at index " << index << endl;
36 }
37 else {
38 cout << "key is not present" << endl;
39 }
40 return 0;
41 }

Callers

nothing calls this directly

Calls 2

binFunction · 0.85
initialFunction · 0.70

Tested by

no test coverage detected