Week10Chap7-I-1

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

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

View Full Document Right Arrow Icon
Janaka Balasooriya CSE 110, Arizona State University Chapter 7 Arrays - Lecture III
Background image of page 1

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

View Full DocumentRight Arrow Icon
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
Background image of page 2
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.
Background image of page 3

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

View Full DocumentRight Arrow Icon
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.
Background image of page 4
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. If the order in which we scan element
Background image of page 5

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

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 17

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

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online