but the problem that comes up is annoying me is this:
to find min and max values in an array, I came across this following algo:
1 2 3
|
8
4(i) 4(ii)
2(i) 2(ii) 2(iii) 2(iv)
|
now, we find minL and maxL in 2(i) and minR and maxR in 2(ii). Then we compare minL to minR and maxL to maxR and come up with minL and maxL of 4(i).
similarly, we do same with 2(iii) and 2(iv) and get minR and maxR of 4(ii).
then we compare minL to minR and maxL to maxR to get the ultimate min and max values of 8.
But now..how can i apply this concept when i know the array doesnt split simultaneously. Then, I came up with a solution that instead of comparing the minL and maxL to minR and maxR, i'll keep two global variables min and max and compare the minL,maxL,minR,maxR to them and update max and min at each time i calculate minL,maxL,minR,maxR.
But, main problem is I am not able to follow the exact algo pattern of comapring minL,maxL to minR,maxR and i want to do that...!!!!!!!!!