DSOOP Class 01
DSOOP Class 01
DSOOP Class 01
ORIENTED PROGRAMMING
CS234
2
DATA STRUCTURES
Date item refers to an single unit of values
Meaningful or processed data
4
Algorithm is a finite set of instructions used to
accomplish a particular task
Characteristics of good algo:
Input: Zero or more quantities
Output: At least one quantity is produced
Definiteness: Each instruction must be clear and
unambiguous eg. a= x /y or z
Finiteness: All algorithm should terminate after
finite no. of steps
Effectiveness: Must be feasible such that it is
executed using a machine or paper& pencil
Eg.z= x/0
5
WHAT IS DATA STRUCTURE?
Data structure is a representation of data and
the operations allowed on that data.
6
7
BASIC DATA STRUCTURE
8
PRIMITIVE DATA STRUCTURE
There are basic structures and directly
operated upon by the machine instructions.
Data structures that are directly operated upon
the machine-level instructions are known as
primitive data structures.
Integer, Floating-point number, Character
constants, string constants, pointers etc, fall
in this category.
The most commonly used operation on data
structure are broadly categorized into
following types:
◦ Create
◦ Selection
◦ Updating
◦ Destroy or Delete
9
NON-PRIMITIVE DATA STRUCTURE
There are more sophisticated data
structures.
10
Linear Data structures:
Linear Data structures are kind of data structure that
has homogeneous elements.
11
NON-LINEAR DATA STRUCTURES:
12
The most commonly used operation on data
structure are broadly categorized into
following types:
◦ Traversal
◦ Insertion
◦ Selection
◦ Searching
◦ Sorting
◦ Merging
◦ Destroy or Delete
13
DIFFERENCE
14
array
Linked list
300
2000 500
1000
15
16
17
SELECTION OF DATA STRUCTURE
18
TYPES OF DATA STRUCTURE
Linear: In Linear data structure, values are arrange in
linear fashion.
Array: Fixed-size
Linked-list: Variable-size
Stack: Add to top and remove from top
Queue: Add to back and remove from front
Priority queue: Add anywhere, remove the highest
priority
19
TYPES OF DATA STRUCTURE
Non-Linear: The data values in this structure are not
arranged in order.
Tree: Data is organized in branches.
Graph: A more general branching structure, with
less strict connection conditions than for a tree
Hash tables: Unordered lists which use a ‘hash
function’ to insert and search
20
TYPE OF DATA STRUCTURES
21
ABSTRACT DATA TYPE AND DATA STRUCTURE
Definition:-
Abstract Data Types (ADTs) stores data and allow various
operations on the data to access and change it.
A mathematical model, together with various operations defined
on the model
An ADT is a collection of data and associated operations for
manipulating that data
Data Structures
Physical implementation of an ADT
data structures used in implementations are provided in a
language (primitive or built-in) or are built from the language
constructs (user-defined)
Each operation associated with the ADT is implemented by one or
more subroutines in the implementation
22
THE CORE OPERATIONS OF ADT
23
No single data structure works well for all
purposes, and so it is important to know the
strengths and limitations of several of them
24
SELECTING A DATA STRUCTURE
zaid shabbir