Professional Documents
Culture Documents
Daa Practical 4
Daa Practical 4
2020BCS02
Page No. Roll no. BIy Date
************ ********* ********** *****
Psactical4
Aim Tmplement BincrsL Seasch and ind
S-leps tahen bu pbO0dam
k **** *********
else
sefuon
binasy.Seasch( a, beg, mid-1 , val)s
Count=Count + 1 . Pos seurn Stat
eoen-15
Count = Count+1ubo. . Fot Tehuen shedt
Anollsys
ASSume Aosay Si20 to be
ThesePote TCn)= 6lgn
.TO) OClog h)
Poogsam
##include < stdio.hY
fnt binasuSe asch (int a [3 , inh beg, înt end ,nt al)
io mid
TP (end beg
mid Cbea + end )/2 5
P Ca [mid] == val)
geusn d t+1 3
else 1 (a Cmidl<val)
sehven binay Jeasch (a, mid + 1 , encd ,tal) 5
e lse
Cetutn binasgSeas ch (a, beg , mfd-1 , tol)
etusn 1
Dal
Page No.
*** ****************{ **************
main
int a IL1425,80 404L62,41, 10
int vall=L
iot n ST20OF (a)/m220f La fo)
iot Xer binckuJeaxdb la OD-LVa)
psintf U Thoelemendc of ho are
Pos
psin f " In flemento be Seaschod i -%cva
iP (ser = -1
prini n fleme rhat psered înhe as 3
else
peinf n Plemes în presest at ecdpostion oPatau
6etusn 0
Output
The elementr
Ihe of asa Oxe 14 25 30 404152 9
Elemodto be eash
Elemai1 pxeie otSpoation of axau
Lonclu.rto
Pso I eliroinater balF oP the 1 Paon rther
feaxchingby OSngho 6eulE of each Compastron.
Lonr emplouf KeruAive appuhacb which yequiser
Stack Space
k k************* % *( %****%**