Introduction To Data Structure
Introduction To Data Structure
Jjait 1 .
to Dato StructureS
1. ntioduction
Concept
and need of DS Abshraçt Data Type
Type.s ot Data structures
i)Lineoar Data Structueg
gtructure S
i)Non- linear Data
3Algorithm Complezity
i ) Time
i ) 9pace Struc
S t r u ctu1eS
tuieS
on Data
Operationg
4
i)TraverSing
i )Searching
i) Insertion
i )Deletion
N) Sorting
Unit- 1
INTRODUCTION TO DATA STRUCTURES
Tntro duction to Data and Dota.
Data Object
Data iS_ col lection of intormation but
mothinnq but a callection of
and humberSalphabetS
Symbols combined to epTesent information
Information is 9ymbolic epresentation. It has
seme usetul meaning that helps in
us makinq g0ad
JdaementS.
2. Data object:-
Data obiect is a teim that eters to a set of
elements Sucha gefmay be finite or infinite.
Data Type
Definition of a t a gtiucture:
A data Structui is a graup o t data elements
Structuse-
Need of Data between the
a c l o s e _ C o n n e c t i o n _ b e
There is
-
9tructurinq
of olata and thesynthe
item.
sis af alaovithm-
data tupe or there ore num ber
For each
o f operationg.
Data 9howd be 1epregented in a way Fhat
makesefficient imple tmentati on of
operation:
If a lineay data is epresented using
lin ke d orqanization then modification
is es9 timeconsuminq where a9 accesSirn9
alarge ist becomes inefficient
In Seguential organization accessing is
efficient but madificati ons are costly
Abstract Dota Type
I n prg1amminqo gituation occurS when
built- in- data typeS 01 not enough to
Data StructureS
int
Ligts
char Arrays
Fioat
baolean Non-linear
Lineat DS
OS
Single
aimenSi on al 1.9tack LTree9
two 2. Queue 2. &raph.s
gimensionat
Multi
dimenSional <-
StructureS
aTe that diuectly
narmallyare dire
Data
operated
upon bs machine -leve instructian.
prim1tiye data 9tructures
9tructures.
axe known as
by a programminq lanquagesS.
Theseare integerS, 1eal, chara ters
boolean.
Data Structures:-
22 Non- primitive
Oata 9truct ureSare
those
Non- pvimitive
which aieCreoted by
d a t a gtructu1 eS
primitive data Structure s.
using data gtructures are
-Non-OYimitive
as ofinear data StruCtures
classitied
Non-tinear data Structures
and b) the
be classilied as inthe
A l s o i t mugt
tree diaqram
data StructureS:
Linear
a) Structures, the elements
elementS
linear data
In inear fashion.
in
are
arranged
elements of a data structure
1f the
linear Or Sequential
Stored in a
Qre
alinear oata stucture.
order,then t iS
of linear data StructuY@
eramples
-The
ae ) Arrays
ii) Linked tist
ii) Stackg
i) Gueues
i) AYrayS
- An aYTay is a Collection at similar datta
-
array
elementS
-The Se data elements have the Same
d ata tu pe.
The elementS of the a a y a1e Stored
in eOnse Cutive meno1. locations.
A 10 20 30
3
fig Linked 1iSt
iii) 9tcckg:
A A Stack is a linear data gtructure in uhich
insertion and deletion of element.sare dane
anly_one end, hich iS Knon as the_
top of the stack. [ TOS1
Sta ck is called a Last In- First Out
LIfo) 9tYucture be.cause thelast
element which is added to the Siack
iS thetirst element hich is ooleted
rom the Stack
AC E
A31
ACXC
AT11 8
ALol A
fiq Stack
iv ueue
A 9ueue is a tiYSt-in , tivstQut data
structuYe ( IFO) im which the element
that is inserted first isfirst one to
be taken out.
-The elementS in a queue are added at
one end called the1ear end and removed
fTom the 0ther end galled he Pront end.
front end Rear end
o 20 30 40
Fiq. Queue
6) Non- Linear Data Structuie:
-Tthe elements of a data Structure are
not Stored in a 9equential order then it is
a non- linea_data gtyuctureS
The exam pleS are tree and graph
araph
1) TYee:
A tree is anon- linear dat a Structure
which eonsis ts of a collectionof node
in a hi erar chical manner
arYanged
The Sim pleSt form of a treeiS a
the
binayytree
-A binary tree consi9 tS of a root node
and left
and 1eft and ight Sub-treeSwhere both
Sub-tree9 are als o binorytrees
R
Ta
fig. Tree
i i Graph -
- A graph is a nan- linear data St ructuve
hich isa collection of vertices
Calso Called nades) and edaes that connect
these yertices
Ag1aph iS f ten viewe d aS a qeneraliza
tion of the tvee gtructure, here instead
ot a purely parent-to- child relations hip
bet ueen the tree nodes.
ig raph
Data 9tvuctures
char
flo at Bool ean
nt