GIVENS: a (an to sort) public static void locateLargestValue(int[] a, int n) n (number of elements in array) { // VARIABLE DECLARATIONS RESULTS: pos (index of largest value in array) // GIVENS: a reference to array to sort – INTERMEDIATES: // n number of elements to sort note – – // that a.length CANNOT be used. m (integer, smaller interval) int pos; // RESULT position of largest value – // INTERMEDIATES posM (position of largest value in int m; // smaller smaller int posM; // used for swapping HEADER pos LocateLargestValue( a, n ) // RESULT return(pos); }
GIVENS: a (an to sort) n (number of elements in array) RESULTS: pos (index of largest value in array) INTERMEDIATES: m (integer, smaller interval) posM (position of largest value in smaller HEADER pos LocateLargestValue( a, n ) public static void locateLargestValue(int[] a, int n) { // VARIABLE DECLARATIONS // GIVENS: a – reference to array to sort // n – number of elements to sort – note // that a.length CANNOT be used. int pos; // RESULT – position of largest value // INTERMEDIATES int m; // smaller int posM; // used for swapping // RESULT return(pos); }
ITI1120WorkBook.docx