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

Intro Data Structures

The document provides an overview of data structures, defining key concepts such as data, records, fields, and entities, and differentiating between linear and non-linear data structures. It discusses various types of data structures, including arrays, linked lists, stacks, and their properties, as well as considerations for selecting appropriate data structures based on factors like memory usage and operation speed. Additionally, it highlights operations that can be performed on these structures and their practical applications.

Uploaded by

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

Intro Data Structures

The document provides an overview of data structures, defining key concepts such as data, records, fields, and entities, and differentiating between linear and non-linear data structures. It discusses various types of data structures, including arrays, linked lists, stacks, and their properties, as well as considerations for selecting appropriate data structures based on factors like memory usage and operation speed. Additionally, it highlights operations that can be performed on these structures and their practical applications.

Uploaded by

harmangill9955
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

DATA STRUCTURES

basic 1lEAMINOLO4Y 0F DATA ORGANIZATION

DaTA -Data is collection o facts and f'gues


a value set af vauas
Data simply efus to o
Some obsevatiems fem an

wlich may apasent


expeimet.
xamþei- Pentage studeuts ete.
to
DATA IreMi- A unit Yaluas a utain type is
singla
Called doata atem.
ttems.
f data
-too diteuat cateqaies
1. Elementan ttems
itms,
A. Gaoup data
items i- Adata iten slick
Elementayy data ae calle
ito Sub-itums
Can not be dividad
data item.
tlmentog
Example i- kollno studnt
Emploge id an
emhleyea
hnoup data items - -A datoa item stich can
called
be divided ento sub ttems ae
:-Name peson Can be dividec into
Exompl Fist name Midde name, Suname.
puson Can be oivided
- D. 0. B
nto day i month k Jea.
fues , Reco ADS AND FieLos ;- Collechion data is
field , Recods ant
Ouganized into a
Filas
hienaucy
fieLD i- field s a singla piece od dnfosmation.
and field holds pahula wind of dah.
RecoRD :- A ucod is collechon aleated date
a

items.
Exambla :- NameRollao DoB o a
Perhula studut
fILES :- Afu is a collection o elated hacstds
Examþk :- File containlng kecogds all
Implay es a an oganiztb'on:
field tEmpidEname | Dept Salaag File.
Record lo1 A
Bc Accounts 1500D

ENTITY i- An sntty s an objeet that has its


èndepeudeut xistena n tee teal oodd. An entty
L5 Somethiug that has cutu'n attbutes o
puopeuhes ich have numeic o non
numie value .
Examble i- Astudent es an ontity The possibe
attubutes fo a studet can be slno,
nam dob et c
The possibe valus for these attibuts
Can be 1834,' A8c',12 2ol0. ,
Curdy
ENTIY SeI - An ntity set ds a collechion od sinila
entities. Ex AMPLE

Exampl i- Emplayees an oganizahion


Students a class.

KEY efers to an attubutea set o


a o w
attu'butes that help us to identif
a tabl

Example i- Puimang key


Uniqu
fomaton is defined as paocessed )
AMATI ON - In sich helps
Summanized o oynanized data coita
dec's lons.
taking
Examble:- Bills
Tine Table.

Enity' Employee
Ename, Dept, Sa lut
Emp-id
lol Abc )
Maketig1 2o4
Enhty
Set

Xyz Acco unts, 2Soso|
DaTA STRUCTURES

.Data Stuctue of oganizing and


computa Ln sevch a e

Yaious operations in an
effecte
Can pufom
Data Steuctue a
Legical o mathemate
modl paticula oganisatin data
data
Data stuctuu is a
anduing
he lati'onship fo
elements n tems t Som

betteu oanisation and stog


What factos nfuen u the selection of a Data
Stuctus?
a data stwctue 's ènfluened
The selecti on
factos such as data type , opeiation spad,
memony osage, and
ease

1. It must be wch enovgh an te st uctu


to muhos te actual helat'onsp af data
in heal
heal ooAl d.
best suited fo
tos ex ambe - Aays an endex.
stou'ng data that c
that can be accesse d
. The spead operatons 's anotHuu cuueal factr.
Sou data stuctus all ouw a fas ter acceSs
modifcation dat a than otens.
puovila constt
fo examþla i- A Hash tabla
Can

seavch opeationi, making


time tomblaxit fo access

excellent choia le
it an
data is
Sig n'feant consideuatia
's also a
3. Memony Usage ight
conshaint, t m
be moS
me e's a
ses
eftiint to USe data stuctuu thst

lass mem omt inked 'st USe mo

to exambla i- dike addtna


aAays , due to
memoy thah
needed fa pointes.
Stoxge ds anote facto that
4. Ease of implamentahon
Can tnfene te cholee et data shuctue.
Som data shuctues a moL comþlex and
mplemeut tun othes.
hade to
Search Te) can be
fou exampla :- B5T (Binanyinplemung nai
than
5. Tue
challengng
data shuctes should be slm þlu cnough
opuah'ons can be pafosmd
bo that diffeent
data effecthvey ond cffiinty
The stody Data Stuucues includes
Kogial descuiptin f He data stucus
&Implem entaten te data stuctuus
tee data
33 Eluanti tatiu onalysis of stucy
Tu's onalysis ds includes datumiais
the amount of memot need to stoe tue
data shucue and e time gued to
puocessy t.
CLASSIFICATION dF DATA STAUcTURES

DATA STRULTURES

LINEAR DATA STRUCTURES NON - NEAR DATA STRUCTURES

STATIC 2YNAHIL
DATA STRUtet TREes hRAPHS

ARRAY
STKS

LINKED L1st
mang diffeent data stuctuus that
difteant ue

bsed to solua diffeent data stwctues that as

Used to solve diffeunt mathematical and


puoblams .

KINEAR DATA STRUCTURE - Data stuctuu a


which data alemnt s oanged sequeutally
wtu each eLmint 's attachud
ts pravious o next adjacent elamut.
to
Can be done n ta

near fashion.
ExAMPLt - ARAAY, STALK,ueUeS, LiNkeb Lisk

" 5TATIc DATA STAUCTUR e :-Stathe Data Stwctu


has a [Link] static data
stuuctis memory s allocated at com bile
t i . It is easiee to accesS
in a statie data stucue.
foR ExAMPLE :- ARRAY
DYNAMIc DATA StRUcTUREi- In Dynamie date
size is not fixed. It can be
Stuctu, the
updated duning the hun time csds
Aandomly
be consideusd efiiut (SPACE CoMPLEMITY)
may hINKED LIsT
foR ExAMPLE

STACK
Q. NoN - LINEAR DATA STRUCTURE i- Data Stuctus
which elemuts ae not anged
i-e t h is no SUcesSe. Ln a non -
Lnigu e Can' t
lnean data stuctus, haverse all te
Llameuts nn a only
ExAMPLE -
TREES

ARAAYS - An ay is a linea data stuctue


and it is a collechon o items stoud n contgou
locaticns. An a a iss a
nemog
finite numnbe
ber af ements
collechon ot
f homog cnous data
type
3o 35

3 4 5 6

ARRAy
4. The elmeuts
Consecuhve memon lo cati ons
a. Ln case the i's a staie
mey
Jouaton i.e memog 's allo cated to aay duuly
Com þi-tim Paagm (ires Size)
index numba Loith uohich diect
3. Away Use
to an element can take plae
4. Insetion and Deletion take moe t'me than
an elment as tt aguius sifing elemeuts from
ne plae to anothe.(Time Consuming)
6. In case an can apply difterut
Searcling techn'gues like lihea [Link] and
Search
t}eent opeahen s Can be pufoumed aet
SUch as Taaversing Inseuting Deletin g Souhng
Seauchin,Initial'z ah'on ,pd ahion
Linked ist is a collechion nocles
LINKED sr :- A
ode
n is aa piece or block o memo
is cmoy
whereas a

A linked ist is line data shutu


D tn s'ch elemets ae not stoud at conhguas
Locatioms.
wmemony
INFO LI NK
START X
A 40o ’81962
1962

In kinked igt eve noda is diuided ent


tso paut s le dnfomation pat and kink pat te
da ta af all
The cnfomatin paut stous 'n tuel'nked ist end Uuk
elemeuts to be stoed next noe
pat stows He adduss ot t
linked l'st
Ln lnked 's t , the a special node Knoon ac
the staut no dla. The stat noda
contans tua addsuse
of Hee first nodle psent u inked ist
In tu link pat od Last node ae is's a
null va lue uslid udicates te end a lin kad
'st.
TyPes 0F LINke LisT ARE
" SiNGLy LINKED LisT
DoueLy LINKED LisT
CiRcULARA LINke LisT
" DovBLy LINkeb Lisr
PROPERTIEs DF Li NKED LisT
[Link] MEMORY AoLA TION- In lnked l'st
dynamic mameny allo cation de memont is allocatel
at t n hme O exe cution tim.

2. IriseRTION - We Can nset as many nodes


as we ant hto te
tu linked i'st upto the
memoy combutu
3 Ex TRA MEMORy - A inked st uses exta
to sto lnks.
4. ELEMeNT Access :- In inked list e
accesS node pausent n ta lnked bst
A| that we haw to do 's to each a
partelae
have nodes befos it
hode we to g0
have to
agh
t INSeRTI oN AND ELETIoN NOT TiME CNSUMINy

In Case af linked list usetion and deleten f


nodes s not time Consomlug . Insetien and delahom
Hi eddesses
pupound bg changg
6. NoN CoNTIGUOus MeMORy ALLorhrims
TION
'- In lnked
bist te nodes Ce Mot stoad at
all
conhiguaas
b ove t e
locattons i'e re s catteed

memoy
1. LiNEAR SEA RCH- In lenkad l'st, nea seael
s applita bla
8. HppICATIONS kinked hi'st ae used to di's ly
Sociol madia feed s
inked tist au Used to histoy
He vished page

Vauous opeatons Can be pufored n iake


Kist - Iniiau 2at'on Inseuhing elenta i Deletig
demunts, Senehng , Updatg , Tuvasingr Revesig
a Lnked 'st
3. STACKSi- Stack 's a inea data stuctues that
Woks
LIFO eu elemul
sich 's eh seted at end usill be deleted o
umoved fom tue stack first
In stack theue ae two opratioms that can
be putoed PusH and Pop. Po P
PUSH

B
A A
ToP
To p
PusH Pog

The PusH opuatien 's Used to nSet a ne

elamet at t ea top af te stack.


Thee Pop opeat'n's Used to an

elemnt fiom top of t u stack


PusH an d Pop opeah'en s aluoays pefoud
at top e stack.
OF STA CK
PeOPERTIES
I. UsUA GE :- Stack ds Used tu mant difeet
agouthms ike Tower of Hanoi tee tiaveusal,
Kecwsion ete
a. LMPLEMENTATIoN:- Sta ck 's mpemented tuoyh
unked 'st
an ay
INSER TION AND DELE TlON - Tu nseten and delatin
3

ot
prfomed at at e e end i'e fom the top
the sta cu.
e ta allocatd
L STAcK OveRFLOLJ - In te stack
foll and shiU anyone attembt
Spae fa e stack i's
eemeuts, t wil lead o stacde
to add mo e

ouenflous and
APPLICA TIONS - Used in the e valuati
expessions
Conversion ot authmet'c
expession tn Infix to Postfix
- Convet
Used tn Medla Playeas
- Used dn Recwsion operath ens
- Usedd a Meuoy Managet
i's a ma data shucte based
4 thueve -ueve a

nseted f'st
Pindple af FIFo ie ekment
w'll be delated fst fhom tee gue
Tuun ae too emds a 9uewe
Ifaont
a Rea

-font points o first e gLee.


last eleut 'n
- Rea points to
i's always pfomed a t a
Tue t'nset'n opeatien
vd
Tae deletion opuat'on i's aloays pufomed at font
end a quee.

ReAR =0.
fRONT =0

Wn front Reas =0 means

I. The 's flFO Shuctw


a. A a
oLdend list a eeuts
simila data type.
3 In seth'on lujey s pufoumad at ar end
alw
Dele ton always puton at feont ud
5 Appicuh'ons i- - bueve is osed for handliy websike
tua ffie
Quee A's os ed to maintain te
playis! in media playees
oli'c can be pufa
Veu'ous opuations
gue e e Degueua, Peek,
Pee sie
Enguus
NoTE!
PecK - Tue font eem ent can be nsbected withot
2uewe usehg a peet opuaiom
5 TReEs i- A tee s a hon - leea data shuctes and
hee e 's
its collecion nodes . In Parent
hioichial data shuchuu ae ie theis 's a

eluts
clild elahon s'p betoeem
speial no da Knouon as the
In a t e t l e i's a
koot nocla sdh a's paesent at dee top
(lo) RooT Nop 6

(a)
RiGHT Soe TRee
LEFT SUs Taee

nodles e tose
KEaF Nobe i-kea f noda. Tey e also
cwld
donot geneate anA
teial noles
Knoon as
tus exampe.
la i1,
7, as dn
fo examþ u i- 8, lo,
nodes sluich geate
- LeAF Nope - Tuose
NoN knouon
knoon as NoN temonal
c ld cles also
no
th 1S 20 u's exa mþb.
foÀ example
teeg ae
Diffnt types f . AVL ThLe
Binoy he
" Bina Search tue
qeneal te
PaopERTeS DF TREG

's Knouon as nom -- lnea data


IA ttae
stutus
's also Knouwn as JecSive
A hee
data shuctue
3 Appicatien s - Use to Cheate Heap
Use to evaluae aetmetie
expassn n Compil desig
tee hiescu'cal Duta Stuctua
A

hauiny paunt
Nodes hauy ild data shucte
Yawous opeuations pufolon he ike
dnsetion deletien, Seonch thavesal, herght
depth , Balancing
Gap h 's non ne au data
hRAPH ' - a

shucwe tht consistste nodes and edges


consists af a fiuite set f Yetices and
It

The aph Can be hepesented as


V's `et Vutices
is set
cdges.
llne that joins tue
tu nodes.
An edge i'S
ae (V,E)
V= Set vethicas : a, B, c, D
8A, BD,DB, AD, CD) AC
E = Set edges
A

PaopeRTlES OF GRAPH
a non -
Wne
inea data shuct

a App 'cah'ons ResoLce Allo catien Geph


Used o epesent te flow
computati en
G Laph ae
Vau'ous opuatens peufomed
vetex
Add vetex , Add edge, Re mo ue
Fist Seae h ) B4eadth
Kmoue Edge, Depth
Poth, ycle Detec'on
est
Shostest
finst Seachy
NEED OF DATA STRUCTUR E
te data and Hee syn tuesis
Tae stuctue
Mlatiue to each ot..
agoitam ae

Data pesentatien must be easy to usndestand


a: USe Can
So tue developer, as well as
make effiiant mpematation af tu opuathin.
Data shutus puovlde an

oganizing ahievig I mangeg and sheuy


data
- Data shuctu mo difcaten 's east
- - It heguies lss tine
- Save Stouge mmory spa ce
- Data epeesentatin i'ss eas
acceSS to database
DIFFERENT UPERA TIONS To BE PeRFORMED ON DATA
S TRUCTURES

diffeent ty pes f operation s that can be


pufomd fou He manipulaten of data tn evet
data stuctue
TraveLsi
Seancwng
3
Soting
4 Insetin
6 Delat
6
Menging
Data Stuctu means
I TRAVERSING Tiavusing stod a

H
to visit t element
n te
paocesing
aluen data shuctue exacty
each element
ony :-Wn we Oant to palnt all tue
tofo exampu i- statemut
clemnts an
a
Loopng
opuah'an
teu t is calle d ta veLsing
In Ckanguage
fo (il; ises ; i+t)
pintt (* vd ",aD),;
In Ct t
language for i:l; is=5 ;it )
LNseRTION - It is Poce ss

neo element nto an


aleady exis hin g
ist d lements o data stuctues .

- It means that the ne element can be ins


at beuig data stuctue end
the data shuctue as any paticula locatien
aey inked List.
dnsutn opuat'n en volves slithy
AIn am
Hod elemuts and hence lts tme consUm
In n ked l'st no sifhug opeation is
elet
hegiet tie hseutng a ne

In Stack
Sta ck and 2uewe nseth'on can be
done f om end. In stack dnsestn
done from top and In guee
Can be
fhom hea enel.
ansention can be done from
In tees, oe Can dnset elemet (nod
any tn .depend tyee
te
In qlaphs Can dhsest vutex and
NeLE TION :- T deleh'on opuat'on ~'s appied to
delete Lmove an elemeut fom an
exishng
at
data shuctu. Tu's operativn can be appieo
locahoMs iu taa data s huctunes.
diffeeu t done at a
-It means delein can be
u
begining end any pahicula locati on
nked ist.
daletion opeuation envelves shfhvt
and hina its time censUming
of elemut
l'st, deletion opeuatien tuvolus
In lnked
addusses.
at
delehon opeahin s appled
- In stack
top ot the stack. opuaen aloays
gueues tee deletion
In gea
peufomad at font end f

4 MERGIN4 i- Meaging
two
comiig
Same data
0
e con tents
ne data stuctue.
Stuctus into
The nes data stuctue afte megit stous
eemuts that. wee Pesent in
all tue
tuoo data stucte.
comben e d tuo o:
MERGE. SoRr agouitm soLta
to cheate tuind
s'osted aHAay
6.5. SoRTINGi- Soting is tue phocess aangy
the elements ii aseninA dascanding odu
The diffet sonting techniqus used to sout
tue elememts ae Bobbu sout, Selecton So,
Insution Sot, Heap Sort, Guick Sod and
ege Sont .
Bobble Sot i- Bubble sot algoithum saieh.
Soits. the elument cithe in a
oee . Bbbe sot censist f
asscandbig
desundi
passes and com þasison
y
als Bubble sot isd's suita be fo smalleu set
data and it does not xeque any additonal
Memoy spau .
Selechin Soti Selechon Sort is a slmple an Q
uthich OLks bt
epe atedly selechng Smallest ( lugust) elemu
from the unsosted poshon a e l'st and moving
it tota soted pohien tue ist .
Lnsuhion Sonti-Insetin Sot is a simþl sohiy
alpu'th m that woks by tuathvey iasohiag eat
element a an eunsnted i'st t into its coct
posi tien in a soLted pohinm He W'st . Ti's
IS olso known as stable
bgick Soud i- bhoick sout olgonta mis a faske and hw'ghty
efie'ut souting algoutnm based on divide and con zue

most populau soting go


amay by fist beakt
into Smallea y and tun buildu
back toyete. It is also sed to Sont to soted
soted y
uto twd soted
Heap Sodi- Heap Sot is an olgo Hamn that sots
data hto a heap data shucu
sy by nsenhug the
Lxhach hoot fou t heap.
and epeakedly xhact
6&SEARCH AN4:- Seaeing afes to tu poass ott
e eguud dnfomat'en fom aa colle ctlen

Dittuent way to search elemuts ae


I kINEAR SeARCH I- kincaa Seunch algoutn tu simble st
maihly used to find tue elemut faM
Semch algo ,s mainly
an nondeed ist.
a BN ARYy SeARcH'- kieny Sech s defined as a

Rading ago, used ta satla y by tapetedly


dn halt and is
u elemet
dioiding idde elnet af te li'st.

You might also like