idastan97

CSCI151 L18 P3

Oct 2nd, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. double minValue(double arr[], int from, int to){
  4.     if (from==to){
  5.         return arr[from];
  6.     }
  7.     int m=(from+to)/2;
  8.     if (minValue(arr, from, m)<minValue(arr, m+1, to)){
  9.         return minValue(arr, from, m);
  10.     } else {
  11.         return minValue(arr, m+1, to);
  12.     }
  13. }
  14.  
  15. int main(){
  16.     double x[]={5.0, 2.0, 6.0, 9.0, -5.0, 0.0};
  17.     printf("%f", minValue(x, 0, 5));
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment