0% found this document useful (0 votes)
20 views25 pages

1.1 Data and ADT

The document explains the concepts of data and Abstract Data Types (ADTs) in data structures, defining data as qualitative or quantitative variables and categorizing them accordingly. It describes ADTs as models that define data and operations without implementation details, promoting abstraction and modular programming. Examples of common ADTs include lists, stacks, queues, sets, and maps, which aid in designing efficient and reusable data structures.

Uploaded by

slimbookmacbook
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views25 pages

1.1 Data and ADT

The document explains the concepts of data and Abstract Data Types (ADTs) in data structures, defining data as qualitative or quantitative variables and categorizing them accordingly. It describes ADTs as models that define data and operations without implementation details, promoting abstraction and modular programming. Examples of common ADTs include lists, stacks, queues, sets, and maps, which aid in designing efficient and reusable data structures.

Uploaded by

slimbookmacbook
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

Data and ADT

By
Mukund Kulkarni
What is Data?
• Dictionary - Facts and statistics collected together for
reference or analysis

• Data are the values of qualitative or quantitative


variables belonging to a set of items.

• Variables are the measurement or characteristics of


the item.

• They might be measured in qualitative terms or


quantitative terms.

• Qualitative terms could be such as country of origin ,


medical treatment, gender etc. Quantitative terms
could be height weight , blood pressure etc.

• Set of items may be population or the set of items we


are interested in.
Qualitative • Non numerical •Robust Aroma
• Frothy Appearance
data • Strong Taste
• Blue Cup
Used
for……..
Example……..
Quantitative • Referring to a number • 200 ml
• 160 Degrees Fahrenheit
data • 30 INR
Discrete data
• - a count
• - involves whole numbers
Types of • - e.g. No of Children in
Quantitative your family
Data Continuous data
• Numerical data
• any values in certain range
• e. g. Temperature
Categories • Data is categorized in to Qualitative and
of Data Quantitative
Qualitative Data
Quantitative Data
Identify each variables as Discrete , Continuous,
Ordinal or Nominal with justification
Abstract Data
Type (ADT)
Understanding the
Concept of ADTs in Data
Structures
What is an Abstract
Data Type?
• An Abstract Data Type (ADT) is a model for
data structures that defines the data and
the operations that can be performed on
it, without specifying how the operations
are implemented.

• Key Characteristics:
• - Abstraction
• - Encapsulation
• - Well-defined operations
ADT - General
Concept
• Problem solving with a computer
means processing data
• To process data, we need to define the
data type and the operation to be
performed on the data
• The definition of the data type and the
definition of the operation to be
applied to the data is part of the idea
behind an Abstract Data Type (ADT)
ADT - General Concept

The user of an ADT needs Several simple ADTs, such as


only to know that a set of integer, real, character,
operations are available for pointer and so on, have
the data type, but does not been implemented and are
need to know how they are available for use in most
applied languages
Data Types

• A data type is characterized by:


– A set of values
– A data representation, which is common to all these values,
and
– A set of operations, which can be applied uniformly to all
these values
ADT in Simple Words

• Definition:
– Is a set of operation
– Mathematical abstraction
– No implementation detail
• Example:
– Lists, sets, graphs, stacks are examples of ADT along with
their operations
Why ADT?

• Modularity
– divide program into small functions
– easy to debug and maintain
– easy to modify
– group work
• Reuse
– do some operations only once
• Easy to change the implementation
– transparent to the program
Implementing an ADT

• To implement an ADT, you need to choose:


– A data representation
• must be able to represent all necessary values of the
ADT
• should be private
– An algorithm for each of the necessary operation:
• must be consistent with the chosen representation
• all auxiliary (helper) operations that are not in the
contract should be private
• Remember: Once other people are using it
– It’s easy to add functionality
The List ADT

• The List is an
– Ordered sequence of data items called elements
– A1, A2, A3, …,AN is a list of size N
– size of an empty list is 0
– Ai+1 succeeds Ai
– Ai-1 preceeds Ai
– Position of Ai is i
– First element is A1 called “head”
– Last element is AN called “tail”
Operations on Lists

• MakeEmpty
• PrintList
• Find
• FindKth
• Insert
• Delete
• Next
• Previous
List – An Example

• The elements of a list are 34, 12, 52, 16, 12


– Find (52) -> 3
– Insert (20, 4) -> 34, 12, 52, 20, 16, 12
– Delete (52) -> 34, 12, 20, 16, 12
– FindKth (3) -> 20
Examples of Common ADTs

Here are some commonly used ADTs:

- List: Ordered collection of elements

- Stack: LIFO (Last In, First Out)

- Queue: FIFO (First In, First Out)

- Deque: Double-ended queue

- Set: Unordered collection of unique elements

- Map: Key-value pairs


Example: Stack as an ADT

Operations supported by Stack ADT:

- push(x): Add element x to the top

- pop(): Remove and return the top element

- peek(): View the top element without


removing
- isEmpty(): Check if the stack is empty

Note: Implementation details (array, linked list)


are hidden from the user.
Summary

• ADT is a theoretical concept in data


structures
• Defines data and operations, not
implementation
• Promotes abstraction and modular
programming
• Examples: Stack, Queue, List, Set,
Map
Understanding ADTs helps in designing
efficient and reusable data structures.

You might also like