Daa 1 Ia Imp QS

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

1.

Def
ineal
gor
it
hm.Whatar
ethecr
it
eri
athatanal
gor
it
hm mustsat
isf
y.Expl
ainwi
thanex
ampl
e.

2.
Listoutt
hei
mpor
tantpr
obl
em t
ypest
hatar
esol
vedbyacomput
er.

3.
.I
ll
ustr
atethetr
aci
ngofQui
cksor
tal
gor
it
hm f
oragi
vensetofnumber
s
[
25,10,
72,
18,42,
11,
64,
58,
32,
9].

4)Consi
dert
hef
oll
owi
ngal
gor
it
hm

Algori
thm GUESS( A[][])
fori:
=0ton- 1do
forj:
=0toi do
A[i]
[j
]:
=0;
(i)Whatdoest healgori
thm compute?
(ii
)Whatisi tsbasicoper at
ion?
(i
ii
)Howmanyt imest hebasicoper
ati
onisexecut
ed?
(iv)Whatist heeffi
ciencyclassoft
hisal
gori
thm?

5).
Expl
aint
heasymptot
icnot
ati
onsBI
GO,
BIGOmega,
BIGThet
ausedt
ocompar
eor
der
s
ofgr
owthofanalgor
it
hm

6)
Der
ivethewor
stcaseanal
ysi
sal
gor
it
hm t
ocheckwhet
heral
ltheel
ement
sinagi
venar
ray
ar
edi
stinct
.

7)Explai
ntherecur
siv
ealgor
it
hm tosol
veTowerofHanoi
probl
em usi
ngr
ecur
rencet
ree.Show
thattheeff
ici
encyoftheal
gori
thm i
sexponent
ial
.

8)Expl
ainspacecompl
exi
ty?Expl
ainhowt
ocal
cul
atet
hespacecompl
exi
tyofan
al
gori
thm(O(1),
O(n)
)

9)Def
ineGr
aph.Expl
aini
ndet
ail
dif
fer
entway
stor
epr
esentagr
aph.

10)Desi
gnanalgori
thm tosear
chanelementinaarr
ayusingl
i
nearsear
ch,
Discusst
hewor
st
case,
bestcaseandaveragecaseef
fi
ciencyofthi
sal
gor
ithm

11)Expl
aint
heconceptofDi
vi
deandConquermethod.Desi
gnanal
gor
it
hm f
orMer
gesor
t
tr
acewit
hanexampleandderiv
eit
sti
meCompl exi
ty.

12)Writ
ear ecur
siv
eal
gor
it
hm t
ocal
cul
ateaf
act
ori
alofanumberandal
sobr
ingouti
ts
eff
ici
ency.

You might also like