Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1
FAST, National University of Computer and Emerging Sciences, Islamabad
Lecture 2: Abstract Data Types
• What is a character?
– What are the operations that can be performed on
characters?
– …
3
FAST, National University of Computer and Emerging Sciences, Islamabad
Lecture 2: Abstract Data Types
• Flight reservation
– List of seats
– Operations
• Find empty seat
• Reserve a seat
• Cancel a seat assignment
4
FAST, National University of Computer and Emerging Sciences, Islamabad
Lecture 2: Abstract Data Types
5
FAST, National University of Computer and Emerging Sciences, Islamabad
Lecture 2: Abstract Data Types
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.
6
FAST, National University of Computer and Emerging Sciences, Islamabad
Lecture 2: Abstract Data Types
Data Type
ADT:
Data Items:
Type
Logical Form
Operations
7
FAST, National University of Computer and Emerging Sciences, Islamabad
Lecture 2: Abstract Data Types
8
FAST, National University of Computer and Emerging Sciences, Islamabad
Lecture 2: Abstract Data Types
9
FAST, National University of Computer and Emerging Sciences, Islamabad
Lecture 2: Abstract Data Types
Boolean data
Data values: {false, true}
&& 0 1 | | 0 1 x !x
0 0 0 0 0 1 0 1
1 0
1 0 1 1 1 1
Character Data
Store numeric codes (ASCII, Unicode)
1 byte for ASCII
2 bytes for Unicode
ASCII
Unicode
Basic Operations ,
- Comparison (equal, less than, greater)
- Use of numeric codes
FAST, National University of Computer and Emerging Sciences, Islamabad
Lecture 2: Abstract Data Types
Integer Data
88 = 00000000010110002
Signed integer:
Store in a fixed number of bits using either of complement representations:
12
FAST, National University of Computer and Emerging Sciences, Islamabad