SlideShare a Scribd company logo
2
Most read
3
Most read
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)

More Related Content

PPTX
Relational model
PPTX
Types Of Keys in DBMS
PPT
data structure
PPTX
B and B+ tree
PPT
Dbms relational model
PPTX
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
PPTX
Transaction management DBMS
PPTX
Functional dependency
Relational model
Types Of Keys in DBMS
data structure
B and B+ tree
Dbms relational model
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
Transaction management DBMS
Functional dependency

What's hot (20)

PPT
Indexing and Hashing
PPTX
The Relational Database Model
PPT
2. Entity Relationship Model in DBMS
PPSX
Functional dependency
PPTX
Slide 6 er strong & weak entity
PPTX
Data Dictionary
PPTX
Heap_Sort1.pptx
PPTX
PPT
Unit01 dbms 2
PDF
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
PPTX
Data structures
PPT
Data modeling using the entity relationship model
PPT
Database Keys
PPT
7. Relational Database Design in DBMS
PPTX
Controls events
PPTX
Merge sort and quick sort
PPTX
Introduction to data structure ppt
PDF
Introduction to database-ER Model
PPTX
Types of keys dbms
PPT
Lecture 1 data structures and algorithms
Indexing and Hashing
The Relational Database Model
2. Entity Relationship Model in DBMS
Functional dependency
Slide 6 er strong & weak entity
Data Dictionary
Heap_Sort1.pptx
Unit01 dbms 2
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Data structures
Data modeling using the entity relationship model
Database Keys
7. Relational Database Design in DBMS
Controls events
Merge sort and quick sort
Introduction to data structure ppt
Introduction to database-ER Model
Types of keys dbms
Lecture 1 data structures and algorithms
Ad

Viewers also liked (20)

PDF
Abstract Data Types
PPT
Abstract data types
PPT
Abstract data types
PDF
11 abstract data types
PDF
Array linear data_structure_2 (1)
PDF
Preparation Data Structures 03 abstract data_types
PPTX
Data structure,abstraction,abstract data type,static and dynamic,time and spa...
PPT
Abstract data types
PPTX
Data structures and algorithms
PPT
Lec3
ODP
Chapter03
PPT
Abstract data types
PPT
Stacks and queue
PPT
Stacks, Queues, Deques
PPT
Data abstraction the walls
PDF
Unit i data structure FYCS MUMBAI UNIVERSITY SEM II
PPTX
Stack in Sata Structure
DOC
Data structure-questions
DOC
Data structures question paper anna university
PPTX
deque and it applications
Abstract Data Types
Abstract data types
Abstract data types
11 abstract data types
Array linear data_structure_2 (1)
Preparation Data Structures 03 abstract data_types
Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Abstract data types
Data structures and algorithms
Lec3
Chapter03
Abstract data types
Stacks and queue
Stacks, Queues, Deques
Data abstraction the walls
Unit i data structure FYCS MUMBAI UNIVERSITY SEM II
Stack in Sata Structure
Data structure-questions
Data structures question paper anna university
deque and it applications
Ad

Similar to Algo>Abstract data type (20)

PPTX
Abstract Data Types
PPT
Introduction To Data Structures.ppt
PPT
Introduction to Data Abstraction
PDF
PPTX
Introduction to Data Structure.pptx
PPT
Data structure
PPTX
Adt
PPT
Abstract data types (adt) intro to data structure part 2
PPTX
Lecture 01
PPTX
Introduction to Data Structures for CS.pptx
PPTX
data types.pptx
PPTX
chapter 1 Introduction to Ds and Algorithm Anyasis.pptx
PPTX
data structures and its importance
PDF
data-structures_unit-01.pdf
PPT
Data Structures: Introduction_______.ppt
PPT
DSA___________________SSSSSSSSSSSSSS.ppt
PPT
Introduction to Data Structure and Algorithms
PPTX
DSA(Lec-1,2,3) For C++ Introduction for basics
PPT
Ds new
DOCX
Algorithms and Data Structures~hmftj
Abstract Data Types
Introduction To Data Structures.ppt
Introduction to Data Abstraction
Introduction to Data Structure.pptx
Data structure
Adt
Abstract data types (adt) intro to data structure part 2
Lecture 01
Introduction to Data Structures for CS.pptx
data types.pptx
chapter 1 Introduction to Ds and Algorithm Anyasis.pptx
data structures and its importance
data-structures_unit-01.pdf
Data Structures: Introduction_______.ppt
DSA___________________SSSSSSSSSSSSSS.ppt
Introduction to Data Structure and Algorithms
DSA(Lec-1,2,3) For C++ Introduction for basics
Ds new
Algorithms and Data Structures~hmftj

More from Ain-ul-Moiz Khawaja (17)

PPT
Algo>Queues
PPT
Application of Stacks
PPT
Algo>Stacks
PPT
Analysis of Algorithum
PPT
Algo>ADT list & linked list
PPT
Algo>Arrays
PPT
Algorithum Analysis
PPT
Sorting algorithums > Data Structures & Algorithums
PPT
Sorting algos > Data Structures & Algorithums
PPT
Huffman > Data Structures & Algorithums
PPT
Graphs > Discrete structures , Data Structures & Algorithums
PPT
Data Structures & Algorithms
PPTX
PPTX
Attribution Theories
PPTX
Attribution Theory
PPTX
Absenteeism
PPT
HRM Employee Turnover
Algo>Queues
Application of Stacks
Algo>Stacks
Analysis of Algorithum
Algo>ADT list & linked list
Algo>Arrays
Algorithum Analysis
Sorting algorithums > Data Structures & Algorithums
Sorting algos > Data Structures & Algorithums
Huffman > Data Structures & Algorithums
Graphs > Discrete structures , Data Structures & Algorithums
Data Structures & Algorithms
Attribution Theories
Attribution Theory
Absenteeism
HRM Employee Turnover

Recently uploaded (20)

PPTX
How to Manage Bill Control Policy in Odoo 18
PDF
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
PPTX
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
PDF
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
UTS Health Student Promotional Representative_Position Description.pdf
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
PPTX
Open Quiz Monsoon Mind Game Final Set.pptx
PPTX
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
PPTX
Software Engineering BSC DS UNIT 1 .pptx
PPTX
vedic maths in python:unleasing ancient wisdom with modern code
PPTX
Presentation on Janskhiya sthirata kosh.
PPTX
Congenital Hypothyroidism pptx
PDF
Phylum Arthropoda: Characteristics and Classification, Entomology Lecture
PDF
Cell Biology Basics: Cell Theory, Structure, Types, and Organelles | BS Level...
PPTX
UNDER FIVE CLINICS OR WELL BABY CLINICS.pptx
PDF
The Final Stretch: How to Release a Game and Not Die in the Process.
PPTX
How to Manage Loyalty Points in Odoo 18 Sales
PDF
Piense y hagase Rico - Napoleon Hill Ccesa007.pdf
How to Manage Bill Control Policy in Odoo 18
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
UTS Health Student Promotional Representative_Position Description.pdf
Week 4 Term 3 Study Techniques revisited.pptx
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
Open Quiz Monsoon Mind Game Final Set.pptx
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Software Engineering BSC DS UNIT 1 .pptx
vedic maths in python:unleasing ancient wisdom with modern code
Presentation on Janskhiya sthirata kosh.
Congenital Hypothyroidism pptx
Phylum Arthropoda: Characteristics and Classification, Entomology Lecture
Cell Biology Basics: Cell Theory, Structure, Types, and Organelles | BS Level...
UNDER FIVE CLINICS OR WELL BABY CLINICS.pptx
The Final Stretch: How to Release a Game and Not Die in the Process.
How to Manage Loyalty Points in Odoo 18 Sales
Piense y hagase Rico - Napoleon Hill Ccesa007.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)