Finding the Index of
a Minimum Value in an Array
Starting at a Given Index
Sometimes we only want to searth through part of the array,
starting at a particular index, startIndex
.
For example, what if startIndex
is 2
?
array |
8 |
18 |
6 |
12 |
9 |
3 |
15 |
|
↑ |
↑ |
↑ |
↑ |
↑ |
↑ |
↑ |
index =
2;
3;
4;
5;
6;
minSoFar =
6;
3;
minIndex =
2;
5;
Kalamazoo College