Abstract Data Types

999 views
900 views

Published on

* Definition of ADT
* Set
* List
* Stack
* Queue
* Map
* Tree
* Graph

Published in: Software
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
999
On SlideShare
0
From Embeds
0
Number of Embeds
8
Actions
Shares
0
Downloads
212
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Abstract Data Types

  1. 1. Abstract Data Types Reggie Santos UP ITDC Content mostly adapted from Mike Scott, UT Austin
  2. 2. Outline Definition of ADT Set List Stack
  3. 3. Outline Queue Map Tree Graph
  4. 4. Abstract Data Type (ADT) Stores data Allows various operations on the data to access or change it
  5. 5. Why Abstract? Specify the operations of the data structure and leave implementation details for later High-level languages often provide built-in data structures
  6. 6. The Core Operations Every Collection ADT should provide a way to: Add an item Remove an item Find, retrieve, or access an item
  7. 7. Additional Operations More possibilities: Is the collection empty? Make the collection empty Give a subset of the collection
  8. 8. –David Jones “Get your data structures correct first, and the rest of the program will write itself.”
  9. 9. Program Logic Formulation
  10. 10. Image credit: Ledork via flickr Creative Commons
  11. 11. Set Unordered collection of data items No duplicate items are allowed
  12. 12. Image credit: pasukaru76 via flickr Creative Commons Image credit: Stacy Spensley via flickr Creative Commons
  13. 13. List Ordered collection of data items Order is important
  14. 14. 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
  15. 15. 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
  16. 16. Stack Core operations: push(x) pop(x)
  17. 17. Stack
  18. 18. Image credit: Toyhouse.cc Creative Commons Image credit: gadl via flickr
  19. 19. Queue Ordered collection of data items FIFO (First In First Out) Inserts an element at the rear and ejects an element from the front
  20. 20. Queue Core operations: enqueue(x) - at rear dequeue(x) - from front
  21. 21. Queue
  22. 22. By Choon Boo LIM Creative Commons By Wilton Scout Group Creative Commons
  23. 23. Map Collection of key-value pairs Also called a: Hashtable Dictionary Symbol table Associative array
  24. 24. Map
  25. 25. By John Gasson Creative Commons By intotheforest via Flickr Creative Commons By Da Pino Creative Commons
  26. 26. 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
  27. 27. Tree
  28. 28. By Claudio Rocchini (Own work) [GFDL, CC-BY- SA-3.0, CC-BY-SA-2.5], via Wikimedia Commons By Vector Fresh Creative Commons
  29. 29. 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
  30. 30. Graph
  31. 31. Summary Definition of ADT Set List Stack
  32. 32. Summary Queue Map Tree Graph
  33. 33. References Mike Scott’s set of slides, University of Texas Austin Wikipedia For images: Wikimedia Commons Flickr

×