Skip to content

Instantly share code, notes, and snippets.

View tolgatuna's full-sized avatar

Tolga TUNA tolgatuna

View GitHub Profile
@nvjkmr
nvjkmr / divideAndConquer.h
Created October 27, 2016 10:56
Divide and conquer search for sorted integer array
/* Divide and conquer search for sorted integer array.
* Pre: Takes array pointer
* Integer to find
* Last index of array
* Initial of array
* Return: Index of the array
*/
int divideAndConquer(int* arr, int toFind, int lastIndex, int initialIndex) {
int mid = initialIndex + ((lastIndex - initialIndex) / 2);