Professional Documents
Culture Documents
array.pdfGoogleDrive
FunctiontoSortthearrayARRbySelectionSort
voidSelectionsort(+ntARRT1,
(
+ntL)
forlintl=0I<L1I++)
(
intSmall=l
or(+ntJI+1J<L1J++)
f[Sa11ARRJ)
Small=J
:fSma11I
nTei
A=ARRSma11
m9
Sma11Te
mp,
or
FunctiontoSearchforanelementfromARRbyBinarySearch
veidB:narysearch(+ntARRT1,
(
:ntData,
+ntL)
LB=O,UB=I11,Mid,Found=o
eout<< rrEnterDatatobesearched
while(LB<=UB&&!Found)
(
r
r
Mid=(LB+UB)/2/
f(MIdDat)
d+1
else
(MdData
d1i
leeFound++
https://drive.google.com/file/d/0BzMUcFgX6LbPVHVMdWh3cWNoTnc/view?ts=563c640e
1/1