Class Notes (1,017,849)
CA (584,792)
U of S (3,517)
CMPT (50)
Lecture 9

CMPT 115 Lecture Notes - Lecture 9: Abstract Data Type, Pseudocode, Iter

4 pages58 viewsWinter 2016

Department
Computer Science
Course Code
CMPT 115
Professor
Jason Bowie
Lecture
9

This preview shows page 1. to view the full 4 pages of the document.
Iterators
CMPT 115 lecture notes
Notes written by Michael Horsch, Mark Eramian, Ian McQuillan, Lingling Jin, and Dmytro Dyachuk
Objectives
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
examples.
3. define 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?
1
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.