Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
19 views

ADT Python

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

ADT Python

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

ABSTRACT DATA TYPE

PYTHON
• An abstract data type (or ADT) 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—that’s what makes it abstract.

• https://www.teach.cs.toronto.edu/~csc148h/notes/abstract-data-typ
es/introduction.html
Some famous abstract data types
Stacks and Queues
the Stack and the Queue. Both of these ADTs store a collection of
items, and support operations to add an item and remove an item.
The Stack ADT

• The Stack ADT is very simple. A stack contains zero or


more items.
• When you add an item, it goes “on the top” of the stack
(we call this “pushing” onto the stack)
• and when you remove an item, it is removed from the
top also (we call this “popping” from the stack).
• The net effect is that the first item added to the stack is
the last item removed.
• We call this Last-In-First-Out (or LIFO) behaviour.
https://www.teach.cs.toronto.edu/~csc148h/notes/abstract-data-types/stacks_and_queues.html
The Queue ADT

You might also like