I want to find the array index of the smallest value in a unsorted array. i am not allowed to sort the array.
public int find_index () {
for (int i = 0; i< 9; i++) {
if (array[i] > array[i+1]) {
the_index = i+1;
}
else {
the_index = i;
}
}
}
return the_index;
}
what is wrong with above code