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

40 views4 pages
9 May 2016
School
Course
Professor

Document Summary

Notes written by michael horsch, mark eramian, ian mcquillan, lingling jin, and dmytro dyachuk. 1 iterators of containers: a list is one example of a container. Here"s a pseudo-code fragment: for every reftoelement el in reftolist alist. A iterator allows a loop to step through a container, one element at a time: the action performed on each element is the known as the visit operation. It can be anything: we have already seen examples of list iteration tasks: Searching for the target in deleteelement, insertafter. What is the visit operation in the each of the iterative tasks listed above: we would like a way to do customized iterators without adding a new operation to the container"s. Adt for each kind of visit operation we might want: for example, we don"t want to have list adt operations for addition, multiplication, average, maxi- mum, etc. 2 a iterator adt: a iterator adt will have the following operations:

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