So, Compared to Nave method, in divide and conquer approach, the number of comparisons is less. However, using the asymptotic notation both of the approaches are represented byO(n). Print Page Previous Next Advertisements
usingnamespacestd; intfindMin(intarr[],intlow,inthigh) { // base case if(low>high){ return0; } // find the minimum and the maximum elements in array `arr[low…high]` intmin=*min_element(arr+low,arr+high+1); intmax=*max_element(arr+low,arr+high+1); ...