이진분할을 이용한 최대,최소값 구하기 알고리즘
#include #include #include #define N 100 int S[N]; void findMinMax(int low, int high, int& min, int& max) { if (low > high) return; if (high - low == 1) { if (S[low] > S[high]) { max = S[low]; min = S[high]; } else { max = S[high]; min = S[low]; } } else if (high == low) { min = max = S[low]; } else { int mid,min1, min2, max1, max2; mid = (low + high) / 2; findMinMax(low, mid, min1, max1); findM..