You are on page 1of 2

HA-4

iD 9ap veeen tatio ith etampE9

Dadjateny makie:
An

Qn eda btw vehes iej


Et:
2

Adjacency ist' gt is a colehon ¢hst of aways tohere ead

3. (
3) Wnte an
BES oith ekampk?

Jnitialie an empky queue&r a et to Keep teach o Visitd veke


tnqueue the Stavt veter wttee quaue eg mayt it ag visikd.
S Lhie ae queue s hot enpty eequeue a veyer fom queue
Repeat step 3 Untl queue is empy
trSavting fom veee
) enqueue 1
2) dequaue
3)dequeue &,erqueue
) dequeue 3
5)dkqueue
The BFS fom vever ( is lia .3,4.
3) oite an alaoritn for DES ort elample?

empty Stack & mavk 1he Stat vertx as vsited.


a Fush the stat vete onto he Stack.
3+ wkle he Stack i5 not empty pop a
he Popped vevcx.
4 Repeat Stp
SPop 3
,3,4 , 2
pele MsT9 And hnd the M6T fox
algovitm.
A. MS s sub haph at is a tee and Spans as
iginal gaph uiie minnining the totas edg e t

(B
tep-1 dhoose a matti
Stp-- Chotse -Tae hotet edae fom tis eto a add t

Step-3" Oroose tae neoves Yerte not yet in te soluhon


2

B
stp
B

Scp-si

S. Find the MST fos the

ghen grapÁ
(o) lo.i)(i)(3 )
S

You might also like