Upload
reggie-niccolo-santos
View
285
Download
1
Tags:
Embed Size (px)
DESCRIPTION
* Definition of ADT * Set * List * Stack * Queue * Map * Tree * Graph
Citation preview
Why Abstract?
Specify the operations of the data structure and leave implementation details for later
High-level languages often provide built-in data structures
The Core Operations
Every Collection ADT should provide a way to:
Add an item
Remove an item
Find, retrieve, or access an item
Additional Operations
More possibilities:
Is the collection empty?
Make the collection empty
Give a subset of the collection
–David Jones
“Get your data structures correct first, and the rest of the program
will write itself.”
Image credit: pasukaru76 via flickr Creative Commons
Image credit: Stacy Spensley via flickr Creative Commons
Image credit: Frances Dinkelspiel via flickr Creative Commons
By Zzubnik (Own work) [CC-BY-3.0 (http://creativecommons.org/licenses/by/3.0)], via Wikimedia Commons
Stack
Ordered collection of data items
LIFO (Last In First Out)
Only the element at the top may be accessed at any point in time
Queue
Ordered collection of data items
FIFO (First In First Out)
Inserts an element at the rear and ejects an element from the front
By John Gasson Creative Commons
By intotheforest via Flickr Creative Commons
By Da Pino Creative Commons
Tree
Collection of nodes (starting at a root node) where each node contains a data value and a list of references to other nodes, with the constraints that no reference is duplicated, and none points to the root
By Claudio Rocchini (Own work) [GFDL, CC-BY-SA-3.0, CC-BY-SA-2.5], via Wikimedia Commons
By Vector Fresh Creative Commons
Graph
Finite set of ordered pairs, called edges or arcs, of certain entities called nodes or vertices
An edge (x, y) is said to point or go from x to y