Daa Lab Evaluation
Daa Lab Evaluation
Taam embeul
y a d a Vankata sa Kth CB.N0cte 20of,
uestion 1
At CoMpan nemed PT 4 T ha a netuooru n tatfons
Conecte d high Spetd (ommunl catton , (nrs Eash
Cutomevs phone iconnecte d to one ttatton. In his
Or he ana
SngineA% RTT have developed a
pototyp a ideophone SATemThat allos two eutoneny
4 Solutionl
tatione That ies wThin 4 odQe
Heve We need to tind
whlch au Connectec
Becaure we have nperlins
to
Stations we e Can deine me Thod t e t
by
all taion) nearb lints uTh in a d u q
print
at erhices and
s fAs we an doines a r loop o
anoThey m nad
h l l and Then
catls
victed to
dtet
attun set.
Pse udocods
AHgorithm ttSet lG):
S7tushon
(VE) 1epresenting
nput 9rph G
Set of
SteHons .
Outtput:
cafov in
Steons Acceb l e t v o m
PrinE"
Stetion 1-hum, "ane: "
neturnsett (G,1,6,Visited).
Ve rtices
Output 7 Set
pint CV)
fov
Tme Comple
me
Search. travey
tnow. for dejthint
As uwe
is O CV+E).
COmplex y
epeat This proce
fov au terion4
we
haveto
nd
hme.
The
ime comple is o ( * (vtEJ -tov Te
ve-for,
Theve-fo
npatTh m
The time delaa a
br ftance. cau can be date vmine-
2
bby muiplying a Sma xedConeten t by t numEbe
communi on. Unk on the
etkphone. netuwoYk.
between. Calle and Cate uppe e The teephone neoo
ot a compan
Lompany. nanad Rr4 T is afree tree. th engine
PT 4T wans to Com pudeth merImum Dotuble.-
Gvean icient al çorThm and implament: fov.
AWnC 2H Otuawîe
s we emoVi ng
h le at nod.
O he ree
t
unt hos erha o 2 nod
hudoco del
C LOunl
AloaTthm
no-nodu CT) z 2l
Aeurn
n0nodes CTD:#2
Neturn c +
tor 1n T nodes
f i leat
damts (T ct)
34 TMximum pa nning Tree can b found H n n alyo
EX
OLrtex a node
Nou chooting
v2vtex au n o
Now chooun2
f 23
ET ET.vCe).
etun ET.
OCv
ime complext
thm BubLle Sort (A,n)
Inpot: aay
to Sor and
leg t
oofput alay
in
Ser trd order
Fo14o
to n-2 do
for to n-2- do
Jo
do
i A] >
Ai+
Swap AC], ^Ci+]
c turn A
Time Complezity
-2 n-2-1
n-
(n-2-) +1
n- -
i-0
(n-1
=oCn)
Sor t (A,):
Algoithm Selec tion
fvay to
be
So ted and engi
npot
in Sor te d Orde y
outpuf : hray
FoT Eo to 7-2 do
Srellii
to n- do
FoT j-í+1
if Sma> S a l CJ do
Smal
n-z
n - A
2
n - 1
nn-
oCr)
For iEI b n- do .
ji-
cwhile i Zo ond AC] AG] do
Te tuvn A
bound
Outrut Aduy in soxted ord er
mid-at)/2
Mesesoet CA, mià)
Mexdesoxt (A,midt \8)
mere CA mid
3)
AlQoithm mesde CA X mia 3)%
mid 1
adss L A [ l -mid
k x
uhile i mid and 4 3d.
P
ALKabrL
i+
A T-r
k-kt
+
aoiThm Guick sov4
(Aa3)
Pivo -h
whtle i4 do
i AC < Pivot do
if
ACT Pivot do
-t
do
ACi]> Pivot and AC] Pivot
Soa P ACia, aG]
Swa p
AI , AC]
Quitt Sort CA,,).
Suice Sor (A,i4,
Time Complexi k y o (n lo7 n).
GAhC onlaki Sons:
o t nl o a n )
Tnfut s2e
On)
Dubble Sodt,Selectlon
sost, insestien Sert
auick sovti hee Soy