04_Lists - List ADT Click to edit Master subtitle style Dr....

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

View Full Document Right Arrow Icon
Click to edit Master subtitle style © 2009 Dr. Tim List ADT Dr. Tim Margush University of Akron © 2009
Background image of page 1

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

View Full DocumentRight Arrow Icon
© 2009 Dr. Tim Goals Understand the meaning and advantages of Abstract Data Types Be able to define a basic ADT for a List Use a List in a program
Background image of page 2
© 2009 Dr. Tim Abstract Data Type A description of a data type together with operations allowed on that type Name the data type Define the values allowed in the data type Descript attributes and methods associated with the data type Encapsulation
Background image of page 3

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

View Full DocumentRight Arrow Icon
© 2009 Dr. Tim Advantages of ADTs Allow the behavior of a data type to be described without specifying the implementation Provide a high level interface to a possibly complex data type Supports reusable code Alternate implementations provide specific types of efficiency
Background image of page 4
© 2009 Dr. Tim List Data Type A List is a sequential collection of elements of some data type Sequential collection means there is a first element and the concept of nextness This also implies each element has an ordinal position Lists have a size
Background image of page 5

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

View Full DocumentRight Arrow Icon
© 2009 Dr. Tim List Data Here we define what is meant by a list A collection with no elements is a List If an item is added to the end of a List, the result is a List Nothing else is a List This implies a List needs an add operation
Background image of page 6
© 2009 Dr. Tim List Operations add(newEntry) add to end add(newEntry, position) The resulting list could be obtained by adding items in a different order (using only add) The position of the first element is 0 Ignore author's idea that Lists are based at 1 remove(position) The resulting list could be obtained by adding all but the removed item (using
Background image of page 7

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

View Full DocumentRight Arrow Icon
© 2009 Dr. Tim List Data We can enhance our definition of a List, including the new operations An empty collection is a List If an item is added to a List at any legal position, the result is a List If an item at a legal position is removed from a List, the result is a List And so on for other operations
Background image of page 8
© 2009 Dr. Tim
Background image of page 9

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

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

This note was uploaded on 02/22/2011 for the course CS 463 taught by Professor Dr. tim margush during the Fall '09 term at The University of Akron.

Page1 / 24

04_Lists - List ADT Click to edit Master subtitle style Dr....

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

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