ch3 - Ch 3. The Data Structures: Lists 3.1 Introduction:...

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

View Full Document Right Arrow Icon
2001-2009 M. D. Evans All Rights Reserved 1 Ch 3. The Data Structures: Lists 3.1 Introduction : Problem : I/T at most 100 integers and O/T them in reverse. Soln: list 1-Dim array. Note: list vs 1-Dim array (part of ) DS one implementation for each DS we consider: 1. Its def/structure and generic opns. 2. Implementation of structure and opns. To Be Studied: 1. general lists - single - double - circular 2. queues and deques 3. stacks 4. trees 5. graphs (if time)
Background image of page 1

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

View Full DocumentRight Arrow Icon
2001-2009 M. D. Evans All Rights Reserved 2 3.2 General Lists: Def : List of elements of type T = a sequence of elements of T together with opns: - initialize to empty - test empty - test full - determine length - retrieve elements (if not empty) - replace any element (if not empty) - insert new element anywhere (if not full) - delete existing element (if not empty) - traverse entire list - move to the next element General attributes of list: - size - collection of elements in list - current position - head - tail (?)
Background image of page 2
2001-2009 M. D. Evans All Rights Reserved 3 Note: sequence may be: a) Contiguous – all nodes ADJACENT in memory. or b) Linked – all nodes NOT NECESSARILY ADJACENT in mem.
Background image of page 3

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

View Full DocumentRight Arrow Icon
2001-2009 M. D. Evans All Rights Reserved 4 3.3 Operations on lists implemented contiguously: Approaches to viewing the list in the array: 1. elements contiguous boy dog mouse zebra 2. elements sparse boy null dog mouse null null zebra Comparisons: which to use?? CONTIGUOUS SPARSE INSERTION DELETION HEAD, TAIL NEXT ITEM Use that suited best to application!
Background image of page 4
2001-2009 M. D. Evans All Rights Reserved 5 The list: Public: //regardless of the list’s implementation: Proc delete (item from list)
Background image of page 5

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

View Full DocumentRight Arrow Icon
2001-2009 M. D. Evans
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/13/2010 for the course CMPT 225 taught by Professor Annelavergne during the Spring '07 term at Simon Fraser.

Page1 / 21

ch3 - Ch 3. The Data Structures: Lists 3.1 Introduction:...

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

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