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

This preview shows pages 1–6. Sign up to view the full content.

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)

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

View Full Document
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 (?)

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

View Full Document
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!
2001-2009 M. D. Evans All Rights Reserved 5 The list: Public: //regardless of the list’s implementation: Proc delete (item from list)

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern