• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Abstract Data Types
 

Abstract Data Types

on

  • 760 views

Definition and introduction to Abstract Data Type. ...

Definition and introduction to Abstract Data Type.


Teaching material for the course of "Tecniche di Programmazione" at Politecnico di Torino in year 2012/2013. More information: http://bit.ly/tecn-progr

Statistics

Views

Total Views
760
Views on SlideShare
760
Embed Views
0

Actions

Likes
0
Downloads
14
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Abstract Data Types Abstract Data Types Presentation Transcript

    • ADTAbstract Data Type
    • Abstract Data TypeA.A. 2012/2013Tecniche di programmazione2ADTs store data and allow various operations on thedata to access and change itADTs are mathematical modelsADTs are extremely useful when designing a complexalgorithmsADTs are not classes (well, not quite)
    • Abstract Data TypeA.A. 2012/2013Tecniche di programmazione3ADTs are “abstract” because they specify the operationsof the data structure and leave implementation details tolaterMore similar to “abstract classes” or “interfaces”(whether the language supports them)Note: Not all implementationdetails can be deferred!
    • Why study ADTs?A.A. 2012/2013Tecniche di programmazione4How many of you will actually go out and create your own ADTfrom scratch?Different ADTs, each one with its own pros and consPicking the right one for the job is an important step in design!Get your data structures correct first, and the rest of theprogram will write itselfDavid S. Johnson(winner of Knuth’s Prize in 2010)
    • Why study ADTs?A.A. 2012/2013Tecniche di programmazione5The goal is to learnhow to learn how touse and create ADTs
    • Built-in ADTA.A. 2012/2013Tecniche di programmazione6High level languages often provide built in ADTs. E.g.:StandardTemplate Library (C++)Java Collections Framework (Java)
    • Common GroundA.A. 2012/2013Tecniche di programmazione7Almost every ADT provide a way toadd an itemremove an itemfind, retrieve, or access an itemMost Collection ADTs provide more possibilitiescheck whether the collection is emptymake the collection emptygive me a subset of the collection…
    • A very simple ADT: Santa’s SackA.A. 2012/2013Tecniche di programmazione8
    • Sack’s OperationsA.A. 2012/2013Tecniche di programmazione9insertToy(toy)Insert a toy in the sackDuplicates are – obviously – allowedextractToy(toy)Remove the given toy from the sack… and make a children happycountToys()Count how many toys actually arestored in the sack
    • Santa’s SackA.A. 2012/2013Tecniche di programmazione10insertToy( )extractToy( )countToys()
    • Santa’s Sack (more efficient)A.A. 2012/2013Tecniche di programmazione11insertToy( )extractToy( )countToys()keep track ofthe number ofobjects
    • The lessonA.A. 2012/2013Tecniche di programmazione12ADTs do not specify the details of the implementationBUTSome information about the algorithms is essential tochoose the right ADTVery high-level, qualitative informationComplexity
    • Licenza d’usoA.A. 2012/2013Tecniche di programmazione13Queste diapositive sono distribuite con licenza Creative Commons“Attribuzione - Non commerciale - Condividi allo stesso modo (CCBY-NC-SA)”Sei libero:di riprodurre, distribuire, comunicare al pubblico, esporre in pubblico,rappresentare, eseguire e recitare questoperadi modificare questoperaAlle seguenti condizioni:Attribuzione — Devi attribuire la paternità dellopera agli autorioriginali e in modo tale da non suggerire che essi avallino te o il modo incui tu usi lopera.Non commerciale — Non puoi usare questopera per finicommerciali.Condividi allo stesso modo — Se alteri o trasformi questopera, o sela usi per crearne unaltra, puoi distribuire lopera risultante solo con unalicenza identica o equivalente a questa.http://creativecommons.org/licenses/by-nc-sa/3.0/