I wrote this algorithm that finds the MAX number in a array of size N:
find_max (s,e,A){
if (s != e){
mid = floor((e-s)/2) + s;
a = find_max(s,mid,A);
b = find_max(mid + 1, e,A);
if (a > b){
return a;
}
return b;
}
return A[s];
}
I'd like to know the time cost, the T(n) equation and if this algorithm is asymptotically larger, faster or equivalent to the non-divide-and-conquer strategy (comparison of each number sequentially).
I came up with some answers but I think they are not right.
Thank You!