7 Abstract Data Types

When using Python, most often you are concerned about what built-in functions or data structures do, not how they work. That makes you a client.

Data Structure: a concrete strategy for storing some data. For example, list and dict. Concerned with "how?"

Abstract Data Type: defines some kind of data and the operations that can be performed on it. It is a pure interface with no mention of an implementation. Concerned with "what?," there is no 1:1 correspondence between ADTS and data structures in any language.

3.2 Stacks and Queues

The Stack ADT

It contains zero or more items. When you add an item, it goes to the top of the stack ("pushing" onto the stack). Items can also be removed from the top ("popping" from the stack). This is LIFO.

Methods:

Queue ADT

It contains zero more items. Items come in and out in FIFO. Adding an item to is called an enqueue operation and removal of an item a dequeue operation.

Methods: