Created
November 30, 2010 16:08
-
-
Save itsaboutcode/721888 to your computer and use it in GitHub Desktop.
Find Min between subarray
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Program Description
Write function "getminrange" 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.
http://www.cramster.com/answers-nov-10/computer-science/arrays-write-function-quotget-min-rangequot-returns_1027784.aspx