MIS 24053 Lecture Notes - Lecture 25: Gold Base

17 views5 pages

Document Summary

Find the smallest value in a list of integers. A list of integers and a value indicating the number of integers. List remains unchanged after finding the smallest value! When looking for value with distinguishing characteristics, need a way of remembering best candidate found so far. Best written as a function - likely to be used often. Use a loop to consider each element in turn. If current element is smallest so far, then update smallest value so far candidate. When done examining all of the elements, the smallest value seen so far is the smallest value. Array with values to be inspected for smallest value. Function that takes two parameters: an integer array and the array size; returns smallest value. For each of the other elements in the array. If it is smaller than the smallest value so far, update the value of the smallest value so far to current element.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents