{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# 06_adt - Data Structures CSCI 102 CS102 C Abstract Data...

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

1 Data Structures - CSCI 102 Copyright © William C. Cheng CS102 C++ Abstract Data Types Bill Cheng http://merlot.usc.edu/cs102-s11

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

View Full Document
Stacks/Queues (Ch 18) Topics to cover 2 Data Structures - CSCI 102 Copyright © William C. Cheng C++ Abstract Data Types Vectors (Ch 22) Linked Lists (Ch 17) Templates (Ch 14)
An abstract data type that separates the logical properties from the implementation details (Encapsulation, Information Hiding) What is an ADT? 3 Data Structures - CSCI 102 Copyright © William C. Cheng The List ADT We can define all the types of things we want to do with a List without really specifying how they should be implemented insert, remove, search, etc. The List ADT How does vector work? The C++ vector is a good example

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

View Full Document
4 Data Structures - CSCI 102 Copyright © William C. Cheng CS102 Extra Slides Bill Cheng http://merlot.usc.edu/cs102-s11
5 Data Structures - CSCI 102 Copyright © William C. Cheng adt_list.h /* * 1) Write an abstract data type (ADT) representation of a * List of integers. This class is purely an interface * (it has no actual implementation details). * 2) The contains() method checks to see if an integer is * stored in the list. * 3) The push_front() method pushes an integer into the * front of the list (prepends). * 4) The push_back() method appends an integer to the * front of the list. * 5) The at() method returns a reference to the integer * at the given index. * 6) The erase() method erases the integer at the given index. * 7) The empty() method returns true if the list is empty. * 8) The size() method returns the number of elements in * the list. * 9) The print() method prints all the integers in the 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 ]}