Horje
binary search c++ Code Example
binary search c++
int binarySearch(int arr[], int l, int r, int x)
{
    if (r >= l) {
        int mid = l + (r - l) / 2;
        if (arr[mid] == x)
            return mid;
        if (arr[mid] > x)
            return binarySearch(arr, l, mid - 1, x);
        return binarySearch(arr, mid + 1, r, x);
    }
    return -1;
}




Cpp

Related
c++ accessing parent class functinons Code Example c++ accessing parent class functinons Code Example
STL c++ Code Example STL c++ Code Example
replace a char in string c++ at a specific index Code Example replace a char in string c++ at a specific index Code Example
convert from hex to decimal c++ Code Example convert from hex to decimal c++ Code Example
C++ REMOVE element from vector Code Example C++ REMOVE element from vector Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8