COMP 1005 Lecture 9: Lecture 9

14 views4 pages

Document Summary

Understand some algorithms on manipulating arrays and lists. An array is a data structure that has elements of the same data type. You must import what is called an array module to define arrays. Arrays loop through all their elements using an index and they can apply many operations such as search, delete, insert, print, sort, etc. Arrays are stored on consecutive locations in memory. There are four steps to finding the maximum element in an array: Loop the rest of the elements leaving a[0] from a[1] to a[6] Compare every time with the new max. if [i] > max (i is greater than max), then max = a[i] (i representing whatever the value was that turned out to be the max). Lecture 9 page 1 representing whatever the value was that turned out to be the max). Passing an array as a parameter to a function.

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