finding a minimum value in an array without using loops
807603Feb 7 2008 — edited Feb 7 2008I can find a minimum value in an array using a loop, but I am unsure of how to do it without any type of of loop
Here is what I have using a loop:
// This method searches for the minimum value in an array
public static int min(int a[]){
int min = a[0];
for(int i = 1; i < a.length; i++){
if(a[i] < min){
min = a;
}
}
return min;
}
How do I covert this to do the same thing, using no loops?
Thank you for replies
Edited by: kazmania on Feb 7, 2008 12:26 PM