{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Week10Chap7-I-1

# Week10Chap7-I-1 - Chapter 7 Arrays Lecture III Janaka...

This preview shows pages 1–6. Sign up to view the full content.

Janaka Balasooriya CSE 110, Arizona State University Chapter 7 Arrays - Lecture III

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Janaka Balasooriya CSE 110, Arizona State University From the Last Lecture Array of Objects Modified Carpeting company case study More array related concepts Sum, average Finding maximum Finding minimum Search in an array
Janaka Balasooriya CSE 110, Arizona State University Finding Max: Algorithm Steps: 1.Assume that the first element is the maximum and assign it to the current max. 2. Compare the next element with the current max. If next element is greater than the current max, change current max to the next element. 3. Repeat step 2 until all the elements are searched.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Janaka Balasooriya CSE 110, Arizona State University Finding Min: Algorithm Steps: 1.Assume that the first element is the minimum and assign it to the current min. 2. Compare the next element with the current min. If next element is smaller than the current minx, change current min to the next element. 3. Repeat step 2 until all the elements are searched.
Janaka Balasooriya CSE 100, Arizona State University Searching : Background Information The problem: A list of elements stored in an array is given. We need to find if a given element is in the list. Example: 12 100 82 52 165 90 Is number 98 in the array? Is number 52 in the array? How we do it? Compare the number to be searched against elements in the array until we find it or done with comparing all the elements.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}