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

Function rightPart

CPP/Problems/BitonicArray.cpp:45–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43 }
44
45 int rightPart (vector<int> vect, int target, int lo) { // search element in right part
46 int hi = vect.size()-1;
47 int mid = lo + (hi - lo)/2;
48 while (lo <= hi) {
49 if (vect[mid] == target) {
50 return mid;
51 }
52 else if (vect[mid] < target) {
53 hi = mid - 1;
54 }
55 else {
56 lo = mid + 1;
57 }
58 mid = lo + (hi - lo)/2;
59 }
60 return -1;
61 }
62
63 int findElement(vector<int> vect, int size, int target) {
64 // DRIVER CODE

Callers 1

findElementFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected