














Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This is the answer sheet of exams
Typology: Exams
1 / 22
This page cannot be seen from the preview
Don't miss anything!















(BFs) is^ an algorilhm (^) Zhat (^) is nd gtaph dala^ or^ searehing Tuu (^) r baunaing suelure. Th
acewrol (^) bread thnse
O (^) souree (^) hocnt in (^) a aph amd^ Then vinild^ all (^) le (^) nedos adyaeenl to the seloctid nods. BFS aeceuus Thea
ond (^) marks (^) tha en i (^) moes slarleg^ naca, tausasds (^) tha (^) neast (^) umeisitid analyses (^) iien.Onee nodas^ and
itna Te tiomy (^) conlinu (^) nlill (^) all
heam ucromhully istid^ anel (^) nark1d.
E mpleL
sib 4 Yau^ hae^ a (^) ghapk oA mumbars^ kaging fromo- Mark 0 os viaiid
Tranwerse ki wn-wAitid
3and 1L
PTO
Spa0 lo has ban maukd as a nost nods ,
Root neds = O
Släp3-> Ois iid, markedl, and inslad inl e quu dala Auuli
QuuL:o23 + 3
Petete values (^) trom (^) quatie and (^) pint a (^) lt
Rasulto, 1,2,3, 5, 6
sta (^) Remainimg (^0) adjacant and (^) umnied nodes ara uisa marked, and (^) imtad (^) inlo (^) t quu Vist s^ amd 1 in (^) any aajuaneo ane mahk hana O as (^) vuiutid (^) andl (^) add lsm
Fer (^) count - (^2) o (^) N-1 (^) do C (^) << Cunl. (^) neat End hor
newVada. (^) met (^) cwrrent, nwt Curet. nit <nwWedoj
E-di Ed
Coede 8 (oy funlion)
Veid (^) inwrtAtN (^) (int data, i poitisn)
uet nsde^ nuwNsda, "cwrrent nt is i hadl= = NuLL)
hnt "Lit^ is^ empty. (^) \n);
elsei4 (poalion = =4)
nod at baginming
als
/Gsates ne^ nede (^) and (^) assign data (^) o (^). naoeds= (^) (Auet nsda ") malloc (^) (sigpof neuwNoela (^) data = (^) data; (uernod)
PTO
TsaurAe to n-I nods
Cwront= head ;
eri-2 i=porilion-1; i++
*Links neu moda with noda ohend it and pruuwious lo
.
nuwNsda (^) nuaf =^ curun (^) ert Cunt> net = neuWoele
print NoDE^ TNSERTED (^) SveCESs (^) FU LLY. In (^) "):
And =, mar(4(o, o)=o, i=
max), , ) +i= 0+2=
=2,maz(4 (),.o)=2,is- S mas({), )+i =2-3=-
()=-1, (^) manl{ (^) l), o) = O, i^ =
uo maz(f(), o)^ +i=^ 0+2=^2
()=2, (^) maz({), (^) o) (^) =2,e =^ - nws manl{l),)+i= 2-l =
PTO
(f 1o 1t2, 6, 13, 12,s)(10,6, 14,6,13, 12, 5) Swob (14> 8) (10,8,1t, 6,3, 12,so)->(* 10o, 8, 6, 13,2so) 5usa (1t> 6) (110, 6, 14,13, 12, So)>(10,9, 6, 3, 112,50) Soop 1+>I) (,10e,6,13, 14, 12, 5o)>(1O9 6, 13, 12 5) Sun (1t+> 12 (t1 P, 6, 13,12, 1t, 5o)>t,10, 6,13,12, 14, So) (So> Third Po
(t1,P,6, 13, 12, It5)>lt10, P,6, 13, 12, 1t,so)
(t (^) 0,6, 13, 12, (^1) s)>(8,10,6, 13,^ 12, 1 (10>)
so S uoap (iO>) (t8,10, 6, 13,^ 2,^ 1t^ 5o)> (^) e 6,10, 13, (^) 12,1 5) Swap l1o>) (t, (^) 61o, 13, (^12) It (^) so) (^) >(t®, 6, 10,3, 1215
(t8,, 1o, 13, 12, t, 5o) >(t8, s, to 12, 13, 1, 5o)
Suwo (B> 12. (t 8, 6,1 0, 12, E,1 50)(®,1, 10, 12,131n5o)
(t8,6, 10, 12,13,1450) (tP, 5,1o, 12 13, 14, so)
so )
(t 6,^ 10,12,13,15)(8,6,1o,^
12,13 (^) 1t So)
(t&, 10, 12, 13, 1t, So)(6,P, 1 12,13, 11> 5e) Swo 8> 6)
Ct6,8,10, 12,13, 1t 5)>(t» 6,8, 10, 12,13, 1,so)
(1o) 1)
(68, 1o, 12, 13,1t, 5o) (+, 4, P, 10, 12, 13, 150) (+>13) (t6,, 1 12, 13, 14,50)>(t,6,0,10, 1213, 4,50) (50) 1
No ta^ gun (^) Jaauencs is (^) altnady ssrad, but^ oun (^) algarilhe ders net^ knou (^) t it (^) s comltid (^) .Tus, zAs^ algetipm ad
ay (^) uaap lo (^) knsus it is (^) sorad.
(t6,8, (^) 10,/2, 13, (^) 1t, (^50) -(t,6,8,10,12, (^) 13,1t (^) 5o) (t6,P,10, 12 /3,+,5o)> (t,6,8, 1, 12,131t, 5) (t,,1D,12,13, )( 6,8, 10, 12, 3, 15)
|(t 6,8^ 1,^ 12,^ 13lts->^ (6,9,10,^ 12,13^15 3o)
(t6y 1o, 12, 3, 1t) 5o)?6,O, 1o,12 13, 1t 5o
TAusTAus, t^ amtad^ sa4junes^ ds»(4,^ 6, e, to,12,13/ 1^59
Alne, ha rusult of Pos-3 is » (t, P, 6, 10, 12 (3, 1*
PTO
ALt= 45 s^ tie nid
Lous = S High 1
Mid =^ Low^ tHgh-
(^2 ) Mid 7 A7=90 wheh^ is^ mel
se, mid-I checkingmous
Lo 5 High = 7
Mid Lous +^ Hh 2 5tZ.
Mid = 6
Now, mid^ as^ ®6,^
uiek was^ agsd s^ fine.
Hene, 4 comparutens^ werL^ riaursd^ and^
f
in Zhe giem anhay.
PTO
C-proham_for (^) he (^) binghy (^) areh (^) alyorithmm =
inelude Ltdio.h> int main )
ankay (^) o pin (^) ( E^ nlar (^) the numken (^) of elumtnts (^) -> (^) 1n);
scant (^) ["%d", k^ array (^) [); Printh (^) CE (^) n vaka^ le^ fid->n") eanf (d",kay) low = ; kh = n-I mid (^) - (lout (^) kigh)/ whike (^) (Lous (^) L= high
(anray L4ky lou= mid +4; a (^) okay Lid]= (^) =ky)
it4(% (^) dl (^) sound at (^) asray Aauilion (^) >/n,
bruak
high = mid - 13
mid-lou +hgk)h.;
Case 1
4 (att== NULLJ
beeak CaAr 2
ort(B; Ca 3
n "^ nnalid^ choies^ )
Pren (^) do (^) yow want^ lo^ corlinue (^) prass (^1) J
skilele ==1)
ede1gpe isunt(»odilyAe ")
jntn
P-(roetgha mallee(sigrodrede))j
i (P!=NoLL)
P->ih =; P- sl = NULL
1 P
nesek=P hsP;
rolurnn
prin (^) not (^) snongh' (^) nanory
veid sort(nadaype "
nedslgpe t; nodiypa *S;
t L tile (t!=NULL)
ile (S!= NULL)
4(tinja) s-> ito)
tino
SAnso = e;
E Mi ehoiss ; 1
Een hu umban; 15
do yow^ want^ lo^ conlinu^ prs^ 1:
EJekese ; 1
Ela As mumhan 25
Elw chsise :
A2 Gumn^ element^ al>
(^3 3) 5, (^) 5o, +o, (^) 25, 3o, fo, (^) 7e, 20 and (^) 2P
Lach (^) lement ne (^) by ont^ amd (^) will be caukirq balamen faetor of zneh. hode bepore adeerg aelkr
o. I/ ths mods is imdsalanead tLAn ue will halarta that node ond hen add ls nnat elemant. Nou, ie
balane feclas. is g by
Balamen Jaetar = height o tejt us-Tre -kigktof nipkt sustru
&= (^) hr =1-1, o, (^) i}
imbalaneud and uR lant to baloner it wwy rolalied.
Tderling plumaad 35
4-0- No huu node 3S is
rotation
halsncd
O (
30
30
follotu (^) Laht (^) Righe (^) Root AS (^) Past (^) ordn
Pot (^) otdet 20,2, (^) 25, (^) 35, 3o, 50, Po, 7P, to.
Ans (^) To cnsrubt (^) ta (^) beinary eareh tee (^) lBsTD (^) for s^ zue paa order Tansse (Po), will first tid o ntrda
e kko too rom u fot ordar ravsrsal an fo ihat aset ue will hunel our lt ses res arol ugkt nb re usung otda rauspal. wa wll repat h
POT-15, 10, 23, z5,^ 20,^ 35,t2 31, (^30) (L R (^) Ret)
TOT-1O 15, 20 23, 25 30, 35, 3, t2(L Rsot ) (Tmorelen rarsal^ o^ formad^ hunst^ arang^ ng^ lereg n asendiny &der)
F om POt Roatis 30
o, 1s,^ 2.0, 3s,34,* Fira we will coriuet tatsuhrr se POT- 1S, 1,23, 25, 2e,35,+2, 39, 30
Tor-9 15,23,2335, 3r,^
R
20
POT-5, L0, 13, 25, 20, 35, + 31, 30
(20)
Now, for rigkt sub ree
PoT-I5,10, 20_3S IOT (^) °, (^) 15, 20,13, 2S (^30)