Use binarySearch to find an element in sorted or monotonic space.#include #include using namespace std;int binarySearch(vector &arr, int x){ int start = 0; int end = (int)arr.size() - 1; while (start Both average and worst case has O(log N) time complexity.