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

Info icon This preview shows pages 1–6. 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)
Image of page 1

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

View Full Document Right 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 (?)
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.
Image of page 3

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

View Full Document Right 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!
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)
Image of page 5

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

View Full Document Right Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern