CMPT 115 Lecture Notes - Lecture 9: Abstract Data Type, Pseudocode, Iter
4 pages58 viewsWinter 2016
Course CodeCMPT 115
This preview shows page 1. to view the full 4 pages of the document.
CMPT 115 lecture notes
Notes written by Michael Horsch, Mark Eramian, Ian McQuillan, Lingling Jin, and Dmytro Dyachuk
After this topic, students are expected to
1. describe what an iterator is in your own words.
2. justify that creating the Iterator ADT furthers the idea of encapsulation of data structure, by giving
3. deﬁne the data structure and operations of the List Iterator ADT.
4. apply the Iterator ADT to any list to perform some customized operations on each element in the list.
1 Iterators of Containers
•A list is one example of a container. Other words we use:
–Set of data
–Sequence of items
–Table of data
•Acontainer is an abstract data structure that contains other elements (which may, themselves be
atomic, or other ADTs).
•Typically a container allows you to add, remove and otherwise manipulate elements of a container.
•It is common to want to “loop through” or iterate each element inside a container.
•(Previous versions of the notes used the term “traversal" instead of “iterator")
•Give everyone a raise.
•Find the 10 highest rated YouTube videos
•Calculate the average...
•Search for spelling errors
•What purchases has a customer made in the past?
•How many players have 500 or more goals in a career?
For each of the above, what is the container? What is the data contained?
You're Reading a Preview
Unlock to view full version
Loved by over 2.2 million students
Over 90% improved by at least one letter grade.