SlideShare una empresa de Scribd logo
1 de 12
1
Abstract Data Types
2
Abstract Data Types
Abstract Data Type (ADT): a definition for
a data type solely in terms of a set of
values and a set of operations on that data
type.
Each ADT operation is defined by its
inputs and outputs.
ENCAPSULATION: Hide Implementation
details
3
Def.
e.g. whole numbers (integers) and arithmetic operators for addition,
subtraction, multiplication and division.
e.g. Flight reservation
Basic operations: find empty seat, reserve a seat,
cancel a seat assignment
Why "abstract?"
Data, operations, and relations are studied
independent of implementation.
What not how is the focus.
a collection of related data items
together with
an associated set of operations
Abstract Data Types
4
Def. Consists of
storage structures (data structures)
to store the data items
and
algorithms for the basic operations.
The storage structures/data structures used in implementations are
provided in a language (primitive or built-in) or are built from the
language constructs (user-defined).
In either case, successful software design uses data abstraction:
Separating the definition of a data type from its implementation.
Abstract Data Types
5
Data Structure
A data structure is the physical implementation of an
ADT.
Each operation associated with the ADT is implemented by one
or more subroutines in the implementation.
Data structure usually refers to an organization of data
in main memory.
File structure is an organization for data on peripheral
storage, such as a disk drive.
6
Data Type
ADT:
Type
Operations
Data Items:
Logical Form
Data Items:
Physical Form
Data Structure:
Storage Space
Subroutines
7
Simple Data Types
Memory:
2-state devices ↔ bits 0 and 1
Organized into bytes (8 bits) and
words (machine dependent — e.g., 2 bytes).
Each byte (or word) has an address making it possible to store and retrieve
contents of any given memory location.
Therefore:
the most basic form of data: sequences of bits
simple data types (values are atomic — can't be subdivided) are ADTs.
Implementations have:
» Storage structures: memory locations
» Algorithms: system hardware/software to do basic operations.
8
Boolean data
Data values: {false, true}
In C/C++: false = 0, true = 1 (or nonzero)
Operations: and &&
or ||
not !
x !x
0 1
1 0
&& 0 1
0 0 0
1 0 1
| | 0 1
0 0 1
1 1 1
9
Character Data
Store numeric codes (ASCII, EBCDIC, Unicode)
1 byte for ASCII and EBCDIC,
2 bytes for Unicode
Basic operation: comparison to determine ifEqual, Less than ,Greater
than, etc. use their numeric codes (i.e. use ordinal value)
ASCII/EBCDIC
Unicode
10
Integer Data
Non-negative (unsigned) integer:
Store its base-two representation in a fixed number w of bits
(e.g., w = 16 or w = 32)
88 = 00000000010110002
Signed integer:
Store in a fixed number w of bits using one of the following representations:
11
Sign-magnitude representation
Save one bit (usually most significant) for sign
(0 = +, 1 = – )
Use base-two representation in the other bits.
88 → _0000000010110000
↑
sign bit
Cumbersome for arithmetic computations
–88 → _000000001011000
↓
1
12
Two's complement representation
For negative n (–n):
(1) Find w-bit base-2 representation of n
(2) Complement each bit.
(3) Add 1
Example: –88
1. 88 as a 16-bit base-two number 0000000001011000
Same as
sign mag.For nonnegative n:
Use ordinary base-two representation with leading (sign) bit 0
2. Complement this bit string
3. Add 1
1111111110100111
1111111110101000
(Flip all bits from rightmost 0 to the end)

Más contenido relacionado

La actualidad más candente

Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Data structure,abstraction,abstract data type,static and dynamic,time and spa...Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Hassan Ahmed
 

La actualidad más candente (20)

Database Indexes
Database IndexesDatabase Indexes
Database Indexes
 
Unit 1 introduction to data structure
Unit 1   introduction to data structureUnit 1   introduction to data structure
Unit 1 introduction to data structure
 
Binomial Heap
Binomial HeapBinomial Heap
Binomial Heap
 
Data Structure and Algorithms.pptx
Data Structure and Algorithms.pptxData Structure and Algorithms.pptx
Data Structure and Algorithms.pptx
 
standard template library(STL) in C++
standard template library(STL) in C++standard template library(STL) in C++
standard template library(STL) in C++
 
Functions in Python
Functions in PythonFunctions in Python
Functions in Python
 
9 python data structure-2
9 python data structure-29 python data structure-2
9 python data structure-2
 
Week 3 Classification of Database Management Systems & Data Modeling
Week 3 Classification of Database Management Systems & Data ModelingWeek 3 Classification of Database Management Systems & Data Modeling
Week 3 Classification of Database Management Systems & Data Modeling
 
Data Structure
Data Structure Data Structure
Data Structure
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 Data Structures - Lecture 9 [Stack & Queue using Linked List] Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 
Visual programming lecture
Visual programming lecture Visual programming lecture
Visual programming lecture
 
Classification of data
Classification of dataClassification of data
Classification of data
 
Arrays and Strings
Arrays and Strings Arrays and Strings
Arrays and Strings
 
Data structures
Data structuresData structures
Data structures
 
PYTHON-Chapter 3-Classes and Object-oriented Programming: MAULIK BORSANIYA
PYTHON-Chapter 3-Classes and Object-oriented Programming: MAULIK BORSANIYAPYTHON-Chapter 3-Classes and Object-oriented Programming: MAULIK BORSANIYA
PYTHON-Chapter 3-Classes and Object-oriented Programming: MAULIK BORSANIYA
 
Data Structures
Data StructuresData Structures
Data Structures
 
Data structures using c
Data structures using cData structures using c
Data structures using c
 
Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Data structure,abstraction,abstract data type,static and dynamic,time and spa...Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Data structure,abstraction,abstract data type,static and dynamic,time and spa...
 
Abstract Data Types
Abstract Data TypesAbstract Data Types
Abstract Data Types
 
OLAP operations
OLAP operationsOLAP operations
OLAP operations
 

Destacado

11 abstract data types
11 abstract data types11 abstract data types
11 abstract data types
jigeno
 
Array linear data_structure_2 (1)
Array linear data_structure_2 (1)Array linear data_structure_2 (1)
Array linear data_structure_2 (1)
eShikshak
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
Harry Potter
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
Tony Nguyen
 
Stacks and queue
Stacks and queueStacks and queue
Stacks and queue
Amit Vats
 
Data structure-questions
Data structure-questionsData structure-questions
Data structure-questions
Shekhar Chander
 
Data structures question paper anna university
Data structures question paper anna universityData structures question paper anna university
Data structures question paper anna university
sangeethajames07
 
03 data abstraction
03 data abstraction03 data abstraction
03 data abstraction
Opas Kaewtai
 

Destacado (20)

Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
11 abstract data types
11 abstract data types11 abstract data types
11 abstract data types
 
Array linear data_structure_2 (1)
Array linear data_structure_2 (1)Array linear data_structure_2 (1)
Array linear data_structure_2 (1)
 
Preparation Data Structures 03 abstract data_types
Preparation Data Structures 03 abstract data_typesPreparation Data Structures 03 abstract data_types
Preparation Data Structures 03 abstract data_types
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
Lec3
Lec3Lec3
Lec3
 
Chapter03
Chapter03Chapter03
Chapter03
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Stacks and queue
Stacks and queueStacks and queue
Stacks and queue
 
Stacks, Queues, Deques
Stacks, Queues, DequesStacks, Queues, Deques
Stacks, Queues, Deques
 
Data abstraction the walls
Data abstraction the wallsData abstraction the walls
Data abstraction the walls
 
Unit i data structure FYCS MUMBAI UNIVERSITY SEM II
Unit i  data structure FYCS MUMBAI UNIVERSITY SEM II Unit i  data structure FYCS MUMBAI UNIVERSITY SEM II
Unit i data structure FYCS MUMBAI UNIVERSITY SEM II
 
Stack in Sata Structure
Stack in Sata StructureStack in Sata Structure
Stack in Sata Structure
 
Data structure-questions
Data structure-questionsData structure-questions
Data structure-questions
 
Data structures question paper anna university
Data structures question paper anna universityData structures question paper anna university
Data structures question paper anna university
 
data structure
data structuredata structure
data structure
 
deque and it applications
deque and it applicationsdeque and it applications
deque and it applications
 
03 data abstraction
03 data abstraction03 data abstraction
03 data abstraction
 

Similar a Algo>Abstract data type

Lec 1 Ds
Lec 1 DsLec 1 Ds
Lec 1 Ds
Qundeel
 
Data Structure
Data StructureData Structure
Data Structure
sheraz1
 
Lec 1 Ds
Lec 1 DsLec 1 Ds
Lec 1 Ds
Qundeel
 

Similar a Algo>Abstract data type (20)

Chapter 1 - Introduction to Data Structure.ppt
Chapter 1 - Introduction to Data Structure.pptChapter 1 - Introduction to Data Structure.ppt
Chapter 1 - Introduction to Data Structure.ppt
 
chapter 1 Introduction to Ds and Algorithm Anyasis.pptx
chapter 1 Introduction to Ds and Algorithm Anyasis.pptxchapter 1 Introduction to Ds and Algorithm Anyasis.pptx
chapter 1 Introduction to Ds and Algorithm Anyasis.pptx
 
Introduction to Data structure and algorithm.pptx
Introduction to Data structure and algorithm.pptxIntroduction to Data structure and algorithm.pptx
Introduction to Data structure and algorithm.pptx
 
Bca ii dfs u-1 introduction to data structure
Bca ii dfs u-1 introduction to data structureBca ii dfs u-1 introduction to data structure
Bca ii dfs u-1 introduction to data structure
 
AQA Computer science easter revision
AQA Computer science easter revisionAQA Computer science easter revision
AQA Computer science easter revision
 
Mca ii dfs u-1 introduction to data structure
Mca ii dfs u-1 introduction to data structureMca ii dfs u-1 introduction to data structure
Mca ii dfs u-1 introduction to data structure
 
Bsc cs ii dfs u-1 introduction to data structure
Bsc cs ii dfs u-1 introduction to data structureBsc cs ii dfs u-1 introduction to data structure
Bsc cs ii dfs u-1 introduction to data structure
 
Data structures and algorithms short note (version 14).pd
Data structures and algorithms short note (version 14).pdData structures and algorithms short note (version 14).pd
Data structures and algorithms short note (version 14).pd
 
Lect1.pptx
Lect1.pptxLect1.pptx
Lect1.pptx
 
Bt0065
Bt0065Bt0065
Bt0065
 
B T0065
B T0065B T0065
B T0065
 
SULTHAN's - Data Structures
SULTHAN's - Data StructuresSULTHAN's - Data Structures
SULTHAN's - Data Structures
 
Chapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfChapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdf
 
Data Structures & Recursion-Introduction.pdf
Data Structures & Recursion-Introduction.pdfData Structures & Recursion-Introduction.pdf
Data Structures & Recursion-Introduction.pdf
 
Lec 1 Ds
Lec 1 DsLec 1 Ds
Lec 1 Ds
 
Data Structure
Data StructureData Structure
Data Structure
 
Lec 1 Ds
Lec 1 DsLec 1 Ds
Lec 1 Ds
 
Data structures using C
Data structures using CData structures using C
Data structures using C
 
Ds12 140715025807-phpapp02
Ds12 140715025807-phpapp02Ds12 140715025807-phpapp02
Ds12 140715025807-phpapp02
 
Lecture 1 and 2
Lecture 1 and 2Lecture 1 and 2
Lecture 1 and 2
 

Más de Ain-ul-Moiz Khawaja (17)

Algo>Queues
Algo>QueuesAlgo>Queues
Algo>Queues
 
Application of Stacks
Application of StacksApplication of Stacks
Application of Stacks
 
Algo>Stacks
Algo>StacksAlgo>Stacks
Algo>Stacks
 
Analysis of Algorithum
Analysis of AlgorithumAnalysis of Algorithum
Analysis of Algorithum
 
Algo>ADT list & linked list
Algo>ADT list & linked listAlgo>ADT list & linked list
Algo>ADT list & linked list
 
Algo>Arrays
Algo>ArraysAlgo>Arrays
Algo>Arrays
 
Algorithum Analysis
Algorithum AnalysisAlgorithum Analysis
Algorithum Analysis
 
Sorting algorithums > Data Structures & Algorithums
Sorting algorithums  > Data Structures & AlgorithumsSorting algorithums  > Data Structures & Algorithums
Sorting algorithums > Data Structures & Algorithums
 
Sorting algos > Data Structures & Algorithums
Sorting algos  > Data Structures & AlgorithumsSorting algos  > Data Structures & Algorithums
Sorting algos > Data Structures & Algorithums
 
Huffman > Data Structures & Algorithums
Huffman > Data Structures & AlgorithumsHuffman > Data Structures & Algorithums
Huffman > Data Structures & Algorithums
 
Graphs > Discrete structures , Data Structures & Algorithums
Graphs > Discrete structures , Data Structures & AlgorithumsGraphs > Discrete structures , Data Structures & Algorithums
Graphs > Discrete structures , Data Structures & Algorithums
 
Data Structures & Algorithms
Data Structures & AlgorithmsData Structures & Algorithms
Data Structures & Algorithms
 
Turn over
Turn overTurn over
Turn over
 
Attribution Theories
Attribution TheoriesAttribution Theories
Attribution Theories
 
Attribution Theory
Attribution TheoryAttribution Theory
Attribution Theory
 
Absenteeism
AbsenteeismAbsenteeism
Absenteeism
 
HRM Employee Turnover
HRM Employee TurnoverHRM Employee Turnover
HRM Employee Turnover
 

Último

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
ssuserdda66b
 

Último (20)

Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 

Algo>Abstract data type

  • 2. 2 Abstract Data Types Abstract Data Type (ADT): a definition for a data type solely in terms of a set of values and a set of operations on that data type. Each ADT operation is defined by its inputs and outputs. ENCAPSULATION: Hide Implementation details
  • 3. 3 Def. e.g. whole numbers (integers) and arithmetic operators for addition, subtraction, multiplication and division. e.g. Flight reservation Basic operations: find empty seat, reserve a seat, cancel a seat assignment Why "abstract?" Data, operations, and relations are studied independent of implementation. What not how is the focus. a collection of related data items together with an associated set of operations Abstract Data Types
  • 4. 4 Def. Consists of storage structures (data structures) to store the data items and algorithms for the basic operations. The storage structures/data structures used in implementations are provided in a language (primitive or built-in) or are built from the language constructs (user-defined). In either case, successful software design uses data abstraction: Separating the definition of a data type from its implementation. Abstract Data Types
  • 5. 5 Data Structure A data structure is the physical implementation of an ADT. Each operation associated with the ADT is implemented by one or more subroutines in the implementation. Data structure usually refers to an organization of data in main memory. File structure is an organization for data on peripheral storage, such as a disk drive.
  • 6. 6 Data Type ADT: Type Operations Data Items: Logical Form Data Items: Physical Form Data Structure: Storage Space Subroutines
  • 7. 7 Simple Data Types Memory: 2-state devices ↔ bits 0 and 1 Organized into bytes (8 bits) and words (machine dependent — e.g., 2 bytes). Each byte (or word) has an address making it possible to store and retrieve contents of any given memory location. Therefore: the most basic form of data: sequences of bits simple data types (values are atomic — can't be subdivided) are ADTs. Implementations have: » Storage structures: memory locations » Algorithms: system hardware/software to do basic operations.
  • 8. 8 Boolean data Data values: {false, true} In C/C++: false = 0, true = 1 (or nonzero) Operations: and && or || not ! x !x 0 1 1 0 && 0 1 0 0 0 1 0 1 | | 0 1 0 0 1 1 1 1
  • 9. 9 Character Data Store numeric codes (ASCII, EBCDIC, Unicode) 1 byte for ASCII and EBCDIC, 2 bytes for Unicode Basic operation: comparison to determine ifEqual, Less than ,Greater than, etc. use their numeric codes (i.e. use ordinal value) ASCII/EBCDIC Unicode
  • 10. 10 Integer Data Non-negative (unsigned) integer: Store its base-two representation in a fixed number w of bits (e.g., w = 16 or w = 32) 88 = 00000000010110002 Signed integer: Store in a fixed number w of bits using one of the following representations:
  • 11. 11 Sign-magnitude representation Save one bit (usually most significant) for sign (0 = +, 1 = – ) Use base-two representation in the other bits. 88 → _0000000010110000 ↑ sign bit Cumbersome for arithmetic computations –88 → _000000001011000 ↓ 1
  • 12. 12 Two's complement representation For negative n (–n): (1) Find w-bit base-2 representation of n (2) Complement each bit. (3) Add 1 Example: –88 1. 88 as a 16-bit base-two number 0000000001011000 Same as sign mag.For nonnegative n: Use ordinary base-two representation with leading (sign) bit 0 2. Complement this bit string 3. Add 1 1111111110100111 1111111110101000 (Flip all bits from rightmost 0 to the end)