I want to ckeck if all elements in an array are the same. I did it recursively, but I want to do it with divide and conquer method. Also I want that the time complexity to be O(n). How can I explain with the master theorem?
bool same_elements(int* array,size_t start, size_t end){
if(start==end) return true;
if(array[start]==array[start+1]){
return same_elements(array,start+1,end);
}
return false;
}