0% found this document useful (0 votes)
0 views

Data Structure ( Section - b )

The document discusses various tree data structures and their traversal methods, including binary trees and search algorithms. It outlines steps for implementing tree operations such as searching, inserting, and deleting nodes. Additionally, it compares linear search and binary search, highlighting their efficiencies and limitations.

Uploaded by

anmol97280
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Data Structure ( Section - b )

The document discusses various tree data structures and their traversal methods, including binary trees and search algorithms. It outlines steps for implementing tree operations such as searching, inserting, and deleting nodes. Additionally, it compares linear search and binary search, highlighting their efficiencies and limitations.

Uploaded by

anmol97280
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Section-8

the alenahiag that be

trees

Ateee (an be in Seveval


natunal to
Aeline
the tiee is xECLiy At7ee is
(olletioa node demates A.

othezide tiee node

R (alled
HRAe
mede
the nodeat

figue ot Tee
suktaee Kigkt suktaee Le RooT
Suktire Sukhee
tngth
>N
elaattg
the al(ontain
l the
Comity eittx fite
hee
binsyic
A
Tete Scasch
N
tite
eSukhG the
gncakns
Suktie nt
Iet Saktere
muat oade Rutra
that binany:
tie SAsch
Tic
Seaxching
n
Biaag
0) Scanchn
Saackiny the
1Sa

isdLafien
3 tite a0 not
4.
Tiataig
MAXTHuk MLALHaM
oPerat ione iun1n 0Ch) timt h is the hequt

Stanclaig ata staied

TrAv
4nexn
Alsei soasth sabn
Sr
eIndcrtion
RocNuil thtn doto Ahtit
add
SteP the tie
laL

The
anade
SteP &

Rchun
in the binany
Ta indLat the
tice
tot data to issatat
Str? 3 1 Rositin

Ste4 tiee
Cactt
INfo data
StelS: lhiny

Ste? 6 PAR -SANE

SteP 7: Eait

n=4o(46>t) n=ee o<2)


Dele ion

te del k
mctond
AvailNulL
Delctiaa
Ste? Li ite eallaaxod Eit

Dhinya adt Tc T
CRtoonav st the
data n
Jind
NEAval,Avail- lelt CâvÂL]
Set ta knt
ade
LialyITEH inte is uandn
Ste?3:
St
1TEH LEÊTLAE
be deâka haing n chilarsas

be deGa
Step4 caL32 Node hasig

RooT
NULL RooT
St PrR RooT Qud PAR
|Se 5
Traveesa

StePL: terkvi
anttaie alyaithn

LEMlaDAR)

StelAi Lac h an
hayea CitRaati)
Emit bstadta tauesa Leti_st- kast)
Roo
SteP 3: 4 Rionu Cloc1Nol ond L8FTL Lo

Stepy: sct LEfr Coc] AvAlL cnd AVALL-lo


SteP5 :
Date
Page

(b) Hew bdeaclth Seaneh


gruapha what is Qaalhh Hos it
xesieasanteA in memay
#ntaPh

Caxaphe set finite


And iS a
ldata stauct not
allaa singla
Seen in
elomat.
data Stiur Au9 be
lie mole tox enamie
Prars
A Sime
-simle siahh

hephih

3
4. S9entckà$h.

simle h

Connecteà gniph

yehe
Sim?le Steng'

Coneeko qaph
Comlete gah
AConlek 5 waKy Cannecita ahAetàh
3
hor

tye

4. cannecteÀ grnßn A stegy tomsch


Stengb
is coiderd that a
TFeas

matia
sttati
antaian

A soushh htalta
dimtonliena)

tink 1st

ganetic ahi

SetdinAndtÝn AA

to itatt A AO
toocofuis tanas
D
Stusshanntal
mmiònc Maizi
inadyaclihie
aaia i s o g i l ati dissàaag 10-11/14
that shffot

STde.

nalat i h

link ist hteenb~n

1st
Sthechand

Sisss

simlleat

Advaontag'y

Adjasey
Table
Disaduta_
Node

4stas

Traversa

man
Adyaxetas aà adtaa HatynaanTh aillt
hase ksateahthat th
visit a9

Aà samtag
Tkeytsasl
dekth ikst biodt
Asjacacst l
itst

ba tavag
thstsal
A_aitm
Traveraa

s ist
travesa thaa
indt A in a

Hst thautda

otigbbas thne
Stet 6 fuit

heldg to b
heckad

fhinatie
Date Date
Page Page

DePth Aist Search

Stanting node o
ist enamine

node
enami
taot

to

(omtinuw eut anothe) Path ano So Gn

method Visit eveey node


to H

Alsorithm

Ste:

ste? & Posh An amd Set statugs [A1 =


SteP 3: Rekeat Stelet While S is net

SeP 4: set PTR = ADT

Ste? 5: Releat Ste, shile TR soll


Stel 6 tuit
Date
Date. Page
Page

n
tree
How a bina
illo Strate
men iaanod (lelt nu)
he o Positiom is
Given tho Posihn& a nodeK
binaxy child:*k
(a) 1e
a* ktl
(b) Risht child :
tke Pacot elamot
Ihere Q man 3 Find
be
Lshica
ln
hinar
a
(Kia)
be H+|
Manimum Sile

Memoiy epkeae ntation

linked
Rehiaeatahien
1 A
B

The data Strurtu

Convetgn
tiee Stared
to ipht
ostig
Date

DATA 4+ Stors the intanimohsn


()
be

a Psinter which to th
equire the ovehead lePt :
doest (1)

a
Ci)Riyt
a child mode itgs Panonst be Paiute
determiws immeaiaty Iink 1ist ehreaeatation
AàvamtasLA

Iimitati om Seaenia keleaiataian


tree
| línked Yepreetahion blnany
mast eliuet
Tae Sequeatial khiedtathioy
o
inalficisat Memany aasiage
Seaustial
imrention nooe
data mouemt amo Iink Iist aelpxeaieatatin
link list s'ace NulL Poiteng
Null Pawterd

defemin Paet node


binar tree to the
by linKed ist link ist

Sn linK list 3
sthactUe
node St imPlennetahon aleta
th tee mebe
Date
Page

sht

Data Pointek

lo 3o
Date
Page

(b EnPlai n inea Searh


binan SRash
Aus Lineax Seakch

The linea Seareh Can be imllememttd


inea data Stzurtue Such ap
lin Ked 1í5t ef This imPleneatahi o
Seeh is limitó
base the

SRquetial

enamlle
Linear Searh

3o

(ine Seseh alorith m

How do eas linea Searra cgk

ae
elemment Cendiderel
Rey Qond checaad
Rstentia math
the Sene.

elonet is tend Suceraaful


tue is
Key Search
Date,
Page
Dote.
Page

5 a

the
Seanch ielda 5mall dataset
key

Time slarR comlieuaty Disad amia_cqe o Iinear) SROrh


Sea

NOT 5uitable stor Data ohen dafa


(1)
bet Cage the
het Case
Sarte inear Seanch not
Koy be. Preatoxt at the rat Suitable berauee t doeg take
abvantag
ndea. So he the Sorled data

Cade the (1) Suitalle fo data Stkur tul

the Preeent at ita date Strur ture like


inden
key be
1inked
dealing
ist ahicda haue seauential
linear Search is nat
Advamtagce Search Sequemtial arceA

linear be
ineafehuly NoT Suitable data when
Starod
be hugl datasat, lintan
data
dea ling aith
Searcn shauld be
dataaot
doeg using inea Seareh
Gtiml.
sizitaat
Dete
Pag

Seaxh
Ginazy
stazt
Ste? :
sit? 3 inlut azTQu amd inítiaize K-o is to sert the data
inPut binazy Search
be Seanchid Ihe
5te? 5:
hinaz Seanch ttae 1ist is
then dividea ito two
Dislay numhis is Peesantt at
locaionCit)
Ste? 6 StoP
Sn binany Search Searre
hall azna ist.
The keduri
Sesreh Seala
timo

The ProcosA is relpatd aqain aqain


is

Seaeh
which
is eutiean ely ellicieat 4Seanch
algenitm (an he ind
\ocahn elemet data
Éme Loumle nity binaz seah

the list
is divided into
)Date
Page
Date
Page

Pantg amd
Aduaataep
to pinazy
(ist
AdvataK
tima comtleaity is olog n) ban mottao

Ca" is larsl

The Ihig nethod thanlinea)


(onaed
binaz Search is aater) al motho becaus9 too
lineas Searelae

im
Binany Time (ounlenity inea Searcn

Averask olbgn)R) Disadvamtases


The XecAÍve method the Sbck
Slac

Binary Sarch BinangommnSeach is Some

Binawy Search
naf Sarked,
be Saled be

DisoAvoaqe
Date
Page.

Algerithm

(A,n)
Ste P2:
binany
n= lem CA
Search

Ste PB: bee = oO


en n-(
Ste S teouet
Ste P6: Retunn
Stop.

You might also like