Return to Snippet

Revision: 35546
at November 10, 2010 06:04 by itsaboutcode


Initial Code
int get_min_range(int array[], int firstSubscript, int lastSubscript)
{
int smallestValue = array[firstSubscript];
int smalledIndex = firstSubscript;
for (int i = firstSubscript; i <= lastSubscript; i++)
{
 if (array[firstSubscript] < smallestValue)
{
smallestValue = array[firstSubscript];
smalledIndex = firstSubscript;
}
}
return smalledIndex;
}

Initial URL
http://www.cramster.com/answers-nov-10/computer-science/arrays-write-function-quotget-min-rangequot-returns_1027784.aspx

Initial Description
Write function "get_min_range" which returns the subscript of the smallest value in a portion of an array containing type int values. It has three arguments: an array, the first subscript in the subarray, and the last subscript in the subarray.

Initial Title
Fine Min between subarray

Initial Tags
array, c++

Initial Language
C++