SlideShare a Scribd company logo
ADT
Abstract Data Type
Abstract Data Type
A.A. 2012/2013Tecniche di programmazione2
ADTs store data and allow various operations on the
data to access and change it
ADTs are mathematical models
ADTs are extremely useful when designing a complex
algorithms
ADTs are not classes (well, not quite)
Abstract Data Type
A.A. 2012/2013Tecniche di programmazione3
ADTs are “abstract” because they specify the operations
of the data structure and leave implementation details to
later
More similar to “abstract classes” or “interfaces”
(whether the language supports them)
Note: Not all implementation
details can be deferred!
Why study ADTs?
A.A. 2012/2013Tecniche di programmazione4
How many of you will actually go out and create your own ADT
from scratch?
Different ADTs, each one with its own pros and cons
Picking the right one for the job is an important step in design!
Get your data structures correct first, and the rest of the
program will write itself
David S. Johnson
(winner of Knuth’s Prize in 2010)
Why study ADTs?
A.A. 2012/2013Tecniche di programmazione5
The goal is to learn
how to learn how to
use and create ADTs
Built-in ADT
A.A. 2012/2013Tecniche di programmazione6
High level languages often provide built in ADTs. E.g.:
StandardTemplate Library (C++)
Java Collections Framework (Java)
Common Ground
A.A. 2012/2013Tecniche di programmazione7
Almost every ADT provide a way to
add an item
remove an item
find, retrieve, or access an item
Most Collection ADTs provide more possibilities
check whether the collection is empty
make the collection empty
give me a subset of the collection
…
A very simple ADT: Santa’s Sack
A.A. 2012/2013Tecniche di programmazione8
Sack’s Operations
A.A. 2012/2013Tecniche di programmazione9
insertToy(toy)
Insert a toy in the sack
Duplicates are – obviously – allowed
extractToy(toy)
Remove the given toy from the sack
… and make a children happy
countToys()
Count how many toys actually are
stored in the sack
Santa’s Sack
A.A. 2012/2013Tecniche di programmazione10
insertToy( )
extractToy( )
countToys()
Santa’s Sack (more efficient)
A.A. 2012/2013Tecniche di programmazione11
insertToy( )
extractToy( )
countToys()
keep track of
the number of
objects
The lesson
A.A. 2012/2013Tecniche di programmazione12
ADTs do not specify the details of the implementation
BUT
Some information about the algorithms is essential to
choose the right ADT
Very high-level, qualitative information
Complexity
Licenza d’uso
A.A. 2012/2013Tecniche di programmazione13
Queste diapositive sono distribuite con licenza Creative Commons
“Attribuzione - Non commerciale - Condividi allo stesso modo (CC
BY-NC-SA)”
Sei libero:
di riprodurre, distribuire, comunicare al pubblico, esporre in pubblico,
rappresentare, eseguire e recitare quest'opera
di modificare quest'opera
Alle seguenti condizioni:
Attribuzione — Devi attribuire la paternità dell'opera agli autori
originali e in modo tale da non suggerire che essi avallino te o il modo in
cui tu usi l'opera.
Non commerciale — Non puoi usare quest'opera per fini
commerciali.
Condividi allo stesso modo — Se alteri o trasformi quest'opera, o se
la usi per crearne un'altra, puoi distribuire l'opera risultante solo con una
licenza identica o equivalente a questa.
http://creativecommons.org/licenses/by-nc-sa/3.0/

More Related Content

PDF
Smart buildings - architectures and technologies
PDF
Gestione dischi - File system - LVM
PDF
Sets, maps and hash tables (Java Collections)
PDF
spChains: A Declarative Framework for Data Stream Processing in Pervasive App...
PDF
Introduzione al Corso - Tecnologie per la Disabilità 2014/2015
PDF
Smart home e smart building nella Internet of Things
PDF
Ambient Intelligence: Definitions and Application Areas
PDF
Nuove tecnologie per nuovi ausili: tendenze e prospettive
Smart buildings - architectures and technologies
Gestione dischi - File system - LVM
Sets, maps and hash tables (Java Collections)
spChains: A Declarative Framework for Data Stream Processing in Pervasive App...
Introduzione al Corso - Tecnologie per la Disabilità 2014/2015
Smart home e smart building nella Internet of Things
Ambient Intelligence: Definitions and Application Areas
Nuove tecnologie per nuovi ausili: tendenze e prospettive

Viewers also liked (10)

PDF
Research Activities in Ambient Intelligence
PDF
Architetture aperte per raccolta, elaborazione e distribuzione di dati energe...
PDF
Ambient Intelligence Design Process
PDF
Cosa è Gnu/Linux - Breve storia - Concetti fondamentali
PDF
Ingegneri e disabilità: abbattere il muro
PDF
Accessibilità dei siti web
PDF
SPARQL and Linked Data
PPTX
Uomini, maghi, superuomini
PDF
Tracciamento delle attività in Moodle
PDF
Bellman-Ford-Moore Algorithm and Dijkstra’s Algorithm
Research Activities in Ambient Intelligence
Architetture aperte per raccolta, elaborazione e distribuzione di dati energe...
Ambient Intelligence Design Process
Cosa è Gnu/Linux - Breve storia - Concetti fondamentali
Ingegneri e disabilità: abbattere il muro
Accessibilità dei siti web
SPARQL and Linked Data
Uomini, maghi, superuomini
Tracciamento delle attività in Moodle
Bellman-Ford-Moore Algorithm and Dijkstra’s Algorithm
Ad

Similar to Abstract Data Types (20)

PDF
Introduzione alla programmazione Android - Android@tulug
PDF
How I did it (in .NET): idiomatic Domain Driven Design
PDF
Designing the User Experience
PDF
Get Solution Manual for C++ How to Program 10th by Deitel Free All Chapters A...
PDF
Fashion guide: CAD e CAD.Assyst
PPT
IC2008 Introduzione Did You Know?
PPT
Riepilogo Java C/C++
PDF
Lists (Java Collections)
PDF
Corso Java - Introduzione
PPTX
Lo sai che si può fare DDD in Javascript grazie a Typescript? Visual Studio e...
PPTX
[ITA] SQL Saturday 264 - Put databases in ALM backgrounds
PPTX
Build a LINQ-enabled Repository
PDF
Complete Answer Guide for Java Software Solutions 8th Edition Lewis Test Bank
PDF
Java lezione1
PDF
LucianoZu_CV
PPTX
Un viaggio alla scoperta dei Language Models e dell’intelligenza artificiale ...
PDF
ORM - Introduzione
ZIP
WhyMCA12 - Android Tools e la gestione di progetti complessi
PPTX
Code Generation con i templates T4 in visual studio
Introduzione alla programmazione Android - Android@tulug
How I did it (in .NET): idiomatic Domain Driven Design
Designing the User Experience
Get Solution Manual for C++ How to Program 10th by Deitel Free All Chapters A...
Fashion guide: CAD e CAD.Assyst
IC2008 Introduzione Did You Know?
Riepilogo Java C/C++
Lists (Java Collections)
Corso Java - Introduzione
Lo sai che si può fare DDD in Javascript grazie a Typescript? Visual Studio e...
[ITA] SQL Saturday 264 - Put databases in ALM backgrounds
Build a LINQ-enabled Repository
Complete Answer Guide for Java Software Solutions 8th Edition Lewis Test Bank
Java lezione1
LucianoZu_CV
Un viaggio alla scoperta dei Language Models e dell’intelligenza artificiale ...
ORM - Introduzione
WhyMCA12 - Android Tools e la gestione di progetti complessi
Code Generation con i templates T4 in visual studio
Ad

Recently uploaded (9)

PPTX
Copia di PROGETTO VIOLENZA sulle donne PCTO
PDF
BÀI TẬP TEST BỔ TRỢ THEO TỪNG UNIT - TIẾNG ANH 10 EXPLORE NEW WORLDS - CẢ NĂM...
PDF
GIÁO ÁN CHÍNH KHÓA TIẾNG ANH 9 - CẢ NĂM - THEO CÔNG VĂN 5512 (2 CỘT) NĂM HỌC ...
PDF
GIÁO ÁN KẾ HOẠCH BÀI DẠY CHÍNH KHÓA TIẾNG ANH 9 - CẢ NĂM - THEO CÔNG VĂN 5512...
PDF
Mazzoni-Reggi-2012-Effetto-Lucifero-Su-Wikipedia.pdf
PDF
16 CHUYÊN ĐỀ BÀI TẬP ÔN THI TUYỂN SINH VÀO 10 - MÔN TIẾNG ANH - THEO FORM ĐỀ ...
PPTX
SLIDE-DE-CURSOS-OssssFICIAL-DA-EGEPI-.pptx
PDF
CHUYÊN ĐỀ BỔ TRỢ NGỮ ÂM, TỪ VỰNG NÂNG CAO - TIẾNG ANH 9 VÀ ÔN THI VÀO LỚP 10 ...
PDF
BÀI TẬP TEST BỔ TRỢ THEO TỪNG UNIT - TIẾNG ANH 10 FRIENDS GLOBAL - CẢ NĂM (24...
Copia di PROGETTO VIOLENZA sulle donne PCTO
BÀI TẬP TEST BỔ TRỢ THEO TỪNG UNIT - TIẾNG ANH 10 EXPLORE NEW WORLDS - CẢ NĂM...
GIÁO ÁN CHÍNH KHÓA TIẾNG ANH 9 - CẢ NĂM - THEO CÔNG VĂN 5512 (2 CỘT) NĂM HỌC ...
GIÁO ÁN KẾ HOẠCH BÀI DẠY CHÍNH KHÓA TIẾNG ANH 9 - CẢ NĂM - THEO CÔNG VĂN 5512...
Mazzoni-Reggi-2012-Effetto-Lucifero-Su-Wikipedia.pdf
16 CHUYÊN ĐỀ BÀI TẬP ÔN THI TUYỂN SINH VÀO 10 - MÔN TIẾNG ANH - THEO FORM ĐỀ ...
SLIDE-DE-CURSOS-OssssFICIAL-DA-EGEPI-.pptx
CHUYÊN ĐỀ BỔ TRỢ NGỮ ÂM, TỪ VỰNG NÂNG CAO - TIẾNG ANH 9 VÀ ÔN THI VÀO LỚP 10 ...
BÀI TẬP TEST BỔ TRỢ THEO TỪNG UNIT - TIẾNG ANH 10 FRIENDS GLOBAL - CẢ NĂM (24...

Abstract Data Types

  • 2. Abstract Data Type A.A. 2012/2013Tecniche di programmazione2 ADTs store data and allow various operations on the data to access and change it ADTs are mathematical models ADTs are extremely useful when designing a complex algorithms ADTs are not classes (well, not quite)
  • 3. Abstract Data Type A.A. 2012/2013Tecniche di programmazione3 ADTs are “abstract” because they specify the operations of the data structure and leave implementation details to later More similar to “abstract classes” or “interfaces” (whether the language supports them) Note: Not all implementation details can be deferred!
  • 4. Why study ADTs? A.A. 2012/2013Tecniche di programmazione4 How many of you will actually go out and create your own ADT from scratch? Different ADTs, each one with its own pros and cons Picking the right one for the job is an important step in design! Get your data structures correct first, and the rest of the program will write itself David S. Johnson (winner of Knuth’s Prize in 2010)
  • 5. Why study ADTs? A.A. 2012/2013Tecniche di programmazione5 The goal is to learn how to learn how to use and create ADTs
  • 6. Built-in ADT A.A. 2012/2013Tecniche di programmazione6 High level languages often provide built in ADTs. E.g.: StandardTemplate Library (C++) Java Collections Framework (Java)
  • 7. Common Ground A.A. 2012/2013Tecniche di programmazione7 Almost every ADT provide a way to add an item remove an item find, retrieve, or access an item Most Collection ADTs provide more possibilities check whether the collection is empty make the collection empty give me a subset of the collection …
  • 8. A very simple ADT: Santa’s Sack A.A. 2012/2013Tecniche di programmazione8
  • 9. Sack’s Operations A.A. 2012/2013Tecniche di programmazione9 insertToy(toy) Insert a toy in the sack Duplicates are – obviously – allowed extractToy(toy) Remove the given toy from the sack … and make a children happy countToys() Count how many toys actually are stored in the sack
  • 10. Santa’s Sack A.A. 2012/2013Tecniche di programmazione10 insertToy( ) extractToy( ) countToys()
  • 11. Santa’s Sack (more efficient) A.A. 2012/2013Tecniche di programmazione11 insertToy( ) extractToy( ) countToys() keep track of the number of objects
  • 12. The lesson A.A. 2012/2013Tecniche di programmazione12 ADTs do not specify the details of the implementation BUT Some information about the algorithms is essential to choose the right ADT Very high-level, qualitative information Complexity
  • 13. Licenza d’uso A.A. 2012/2013Tecniche di programmazione13 Queste diapositive sono distribuite con licenza Creative Commons “Attribuzione - Non commerciale - Condividi allo stesso modo (CC BY-NC-SA)” Sei libero: di riprodurre, distribuire, comunicare al pubblico, esporre in pubblico, rappresentare, eseguire e recitare quest'opera di modificare quest'opera Alle seguenti condizioni: Attribuzione — Devi attribuire la paternità dell'opera agli autori originali e in modo tale da non suggerire che essi avallino te o il modo in cui tu usi l'opera. Non commerciale — Non puoi usare quest'opera per fini commerciali. Condividi allo stesso modo — Se alteri o trasformi quest'opera, o se la usi per crearne un'altra, puoi distribuire l'opera risultante solo con una licenza identica o equivalente a questa. http://creativecommons.org/licenses/by-nc-sa/3.0/