Вы находитесь на странице: 1из 19

I

I
I

I73.27try
Solved Question Papers ;i:
Ee- 18 l: s. ll-oali
r:: apolap u
p minirn -,mn E:;OfaJ alE
06cs62 := *r:!s ]o s€
ET:
[1 16! u);i]Al 3O
s.
7ex. 1Ser3iliii
Fourth Semester B.E. Degree Examination, Dec-Jan z: ai:8utf,d
:.1-3o1ei

:--s P oi pal
r -tl0- Ses 2008-2009 Analysis and Design of Algorithms I u o l-,,n auop A,
Time: 3 hrs Max. Marks: 100 )S a..1i iaAO
t
Note: 1. Answer any FIVE full questions, selecting at least TWO questions from each parl :auEeiu 1o e
-+--= < 'r-rprr!
rli"r:_
A and part B.
u. a-i:Jel o'
r aaD,rjqlal a
r f.'ac,ouq:at
PART A he q:iur. sa
.
=nbtuq-1
s,arlepe at
I ' dt.l15:iir
a. Discuss the various stages of algorithm design and analysis process using flow chart.
A{ io uol}e
(10 Marks) -3-"-ut-:-:tY:
b. Explain important fundamental problem types of different categories. (10 Marks) , . rilc.r.-lai0Ja
( p: sttcrt ,<3c
2
ulal uAri.!1
a. Explain in brief the basic asymptotic efficiency classes. (06 Marks) lir:39 qlns,
b. Explain the method of comparing the order of the growth of two functions using Lis ;? -ir}?i
d il .i.ru-t1xs
limits. Compare order of growth of following functions (i) log2nand, Ji (ii) (tog2 id !3L ,C laAO P'
n)2 and,log2r?. (09 Marks) '' ha.c, aqi p;
c. Discuss the general plan for analyzingefficiency of non-recursive algorithms. [) -olit3]ap
lr oeseq sant
(05 Marks) ! Idl s!'.['t/Y
J
?eu Plel frla
' 3*r,*q ale sPl
a. What is brute-force method? Explain sequential search algorithm with an example. e- aqr Aq pallt
Analyse its efficiency. (10 Marks) rer aql}e'l] ur,
b. Write the merge sort algorithm and discuss its efficiency. Sort the list E, X, A, M, p, s 3r-,li::rua dq
.elep rl1
L, E in alphabetical order using merge sort. !F :r
(10 Marks) l.'ori sall^aP
4 ,a1,r E S? Si)P

a. What is divide-and--conquer technique? Apply this method to find multiplication of


integers 2101 and 1130. (0g Marks)
b. Explain the differences between DFS and BFS. Solve topological sorting problem
using DFS algorithm with an example. (l?Marks)
Q-2 Solved Question papers

PART B

a' Explain bottom-up heap sort algorithm


with an example. Anaryse its efficienq,"-

b. Write Horspool,s ulg:llh- Apply Horspool algorithm -


BAOBAB in the text BESS_KNEw_agour_ga6eaBA. to search ,", [].: ffi
(lol\{adu#

a. write warshail's algorithm. Appry warshafl,s


- - "-Dv'^r,t rv rurl
argorithm to find the transitive crorc
of the following Fig. No. 6(a) (10 Meffi

Fig. 6(a)
b. Solve the following Knapsack problem
programming.
with given capacity W: 5 using dynm
(10 Ma*nm
Item Weight Value
1
2 $12
2 I $10
3 J $20
4 2 $1s

write Dij^kstra's algorithm and apply the same


to find single source shortest pette
problem for the following gaph taidng
vertex ,a,as source?, fig. N". 7(a).
(10 Ma*st

what are decision trees? Explain the concept


with an example' r- of
-^ decision
YYvrsrv'trvvD
trees rt'r
for sorting algorithms
(10 Marks)
ll l1 rl
,l 'tt

f,ii , :: I"1
So/ved Quesfion papers Q-3 ,{' l{

a. Briefly explain the concepts of P, NP and NP complete problems. (10 Marks)


b. Explain back-tracking algorithm. Apply the same to solve the following instance of
the subset*sumproblem: S : {3, 5, 6,7} and d : 15 (10 Marks)
ftuNil

Eil@

hmil

ru@
lmr

mrl[
fu$
ls,
l * --- -::-:-:
h-.,-:,,';-=-

; -. =

! d c l- *- ,s

1, --,-=-=.
a- ----- -^^-
I -=:=- :-

! ,:l . -- i',
. 2:-' '.=
arhs
: ^^
=^
-- -^
: : _ i- -:
rl:.< "a ' -
=- =
s!-"*:;:
F : ::a: r.:
, s rl--:=l':3
: i; ::: : ;-i:
I

-- _i

hrn-r
rks t
t-o

5--
Zla-rl5-
Analysis and D_esign ofAlgorithms
Solutions for OeclO0S_Jan
2009

PART A
l.
a' The stages of argorithm
design and anarysis-process
RererropageNo. q-rs using flow chart.
b. fA"eE
Imporranrfundamenralproblemrypes
t
sdF.3u;tuI Gli#trr;krlnr
Refer to page No. 17_21 -(gt$il)
2. FD/ Irorrf
a. Basic asymptotic efficiency
classes
Refer to page No. 55
b. Using limits for c orders of growth
Refer to ,u*" *o.o#aring
c. Comparing
(i) Iog2 n and, Ji
Refer page No. 54, example
2.
(ii) (log2 n)2 and.log2n2

fi^(lrg, O: - [kos, nz)]t _ Y :


*'* log2 n'
flog, n2lt
- g Iog n

n
]fltogr=""
(1og2n_)2has alargerorder
of growth than g(n)
General plan for analyzing.ffiri;;
Refer to page No. 5g_59
;ror_rrrrrriu. algoritfims,
a
J.
Brute-force method definition a. DividE
Refer to page No. 93145
Refert
algorithm with an example Divide_
i:H:ilT[:'i'l and its errciency
Efficiency analysis_Refer
to page No. 4546
lili -
I,
iil _
ry
Solved Question Papers Q-5

b. Merge sort algoritl'rm, efficiency


Refer to Page No. 119-120
Sorting the list E X A M P L E in alphabetical order using merge sort

EXAMPI-E

irl i,e

AEEI-MPX

4.
a. Divide -and-conquer technique
Refer to Page No. I l7
Divide-and-conquer to find multiplication of integers 2101 and 1130

i-o

ai
t3fiL
*--=-
-llrr
Q-6 Solved euestion papers

2101 * ll30 :2374130

Ql * tl) rc4 e2 * 4t _26D rc2 *30


01

{2* Drcz (3*2=3_)to (I*t) (o * 3) 102 (1 * 3 _ 0) 10 (t*o)

Q*qrc2 (4*5-10)10r (2*l)


Difference between DFS and
BFS
Refer to page No. 161
Solving topological
lofl_nqnrobrem using DFS algorithm
Refer to page No. with an example
rc,q;lrc5,ftg"* N;. ;.;

PART B
5.
a. Bottom-up heap sort argorithm expranation
with an exampre.
Refer to page No. 213,215116
Efficiency analysis:
Refer to page No. 216
Horspool's algorithm
Refer to page No. 245/246.
searching solution using
It.*
Refer to Answer 5 (c) of June
Horspool,s algorithm
ti"tv iOg-question paper.
6.
Warshall's algorithm
Referto pageNo.272
Finding transitive crosure
of the given graph using warshalr,s
argorithm.
T}
I ilrU
I ,'rf

t:, C
i

So/yed Question papers e-z

Fig. 6 (a)

qbcd
alo o o ll
ulr o 1 ol
.l t o o rl
,Lo o I o_j

Ro: 010
rample 001
010

Rz:

)-o
ithm.

5-!c_-!;
Z i A - - 5 0-
Q-8 Solved Quesfion Papers

a b cd
aft o l ll
no: alr o 1 tl
"lr o I 1l
olr o r rl
Knapsack problem solution using dynamic programming
Refer to Page No. 285, Example 1, Figure No. g.l3
7.
a. Dijkstra'salgorithm
Refer to Pages No. 307 and309
Solving for single source paths problem for the given graph.

Tree vertrics Remaining vertics Illustration


a(-, 0) B(a,4), c(a,2), d (-,
f(-, -)
-), e(-, -), a.
,\o
c(a,2) b(a, 2+l), d(c, 2+8), e(c, 2+10),
f(-, -)
b(c, 3) d(b, 3+5), e(c, 12)
f(-, -)

Coatl
fflq
rdl
*l
E
i'li'
So/ved Quesfion Papers Q-9 ,tr
$l
d(b,8) e(d,8+2)
f(d,8+6) *l
il
olIta
FtsP4E
il18 iL{F

e(d, 10) f(e, 10+3) rflD


J
qN

f(e, I 3) !
ppa{
ilr i, drll q
Eq'm
lurs a
ftJa!ffi
lele5
Shortest path are tr&ai
atob: a1c -)boflength3 -- Ferd
ftffilqii
atoc:aJcoflength2 Smq
a to d: a -) c + b -+ d oflength 8
lsd
I'qr
ld
ato e: a -) c -) b -+ d J e oflength 10

b.
ato f: a -) c -i b + d -J e 9 oflength
Decision trees definition
13
i,f*,
I,r*,
cn Refer to Page No. 366 ht
-eraph.
Decision trees for sorting algorithm [,n,
Refer to Page No. 367-368 F**
Example r{ Pftl
Hr.,r
Refer to Pages No. 3681369, Figure No. 11.2/Figure No. 11.3
h.*
h*
Concepts of P, NP and lrIP complete problems P'r
Refer to Page No. 373-379 FId
u Fqr
b. Back-tracking algorithm instance for subset sum problem using back- hrp
tracking. F"
lE;
Refer to Page No. 398, Figure No. 12.4
Ln,
hlrn
1,,^,

t:
Lrr
f-
Contl I
F
I

!-

g#r EnEaJ&
s{r
Solved Question Papers Algc
USN i

end

06cs62 Set r
the a

I Fourth Semester B.B. Degree Examination, J.

June-July 2009 Analysis and Design of Algorithm a. Writ


Time: 3 hrs Max. Mar*s;
Note: 1. Answer any FIVE full questions selecting at least TWO questions from each b. Writ
c. Ord

PART A
a. Cm
1. the N

a. With figure, explain algorithm development process. (10lv{affir the r


b. Explain how priority queue can be implemented as unsorted anay. (6 Mffir uu[
--
c. Find GCD (60, 2\ by applying Euclid's forrnula. Estimate the number of - b. wdt
computation is done in Euclid's method and in an algorithm based on che*i; c. Brid
consecutive integers from min (m, n) down to gcd (m, n). (4Mary and:
2.
a. Explain all asymptotic notations used in algorithm analysis. (6 MadNil
b. Consider the following algorithm
Algorithm Enigma (A[0.. n 1, 0.' n 1])
for I -+ 0 t-o n-2 do a. Desi
F^- : / i+1 to n-1 do
!v! \
J

if A[i, jl + Alj, il nud


.hatr
return fafse
end for b. Cm
end for c. Ad
return true NEU
end algorithm Also
i. What does this algorithm compute? 6.
ii. What is its basic operation? a. Foril
iii. How many times is the basic operation executed? aveE
iv. What is the efficiency class of this algorithm? b.Expl
v. Can this algorithm be further imported? (10 Marksl

Consider the following recursive algorithm for computing the sum of the first n cubes
tr lllll
lfl
d
T
So/ved Question Papers Q-11 il I'L I

I
TI

s (n) : 13 + 23 + 33 + ... + .,' f,


Algorithm S (n) I
if (n : 1) return 1 I
efse return (S (n*1) + n* n* n)
end alqorithm
wqrl
o1]llraF
pep@
Set up and solve a recurrence relation for the number of times the basic operation of
$E rFrE
the algorithm is executed. (04 Marks) lr@r{B{
sl] Il"
nation, Fpefll
a. Write the quick sort algorithm. Trace the same on data set 5, 3, 1, 9, 8, 2,4,7.
\lgorithms (10 Marks)
druryto
ri, lSqm{
Marks: 100
trt{ax. hp am
b. Write an algorithm to find the height of binary tree. (4 Marks)
irms from each Part- Uoufu
c. Outline an exhaustive search algorithm to solve a travelling salesman problem. 4eqI
(6 Marks) fqtilar#
haqr
4.
Consider a set of 13 elements in an array list. State the elements of array that require
- h*nm
lxequ
the largest number of key comparisons when searched for by binary search. Find iru
Isry
(10 Marks) the average number of key comparisons made by search in successful search and
ty. (6 Marks) unsuccessful search in this array. (6 Marks) l4{
l,n P"
p number of times b. Write depth first search algorithm. (8 Marks) I

r based on checking c. Briefly explain how breadth first search can be used to check connectness ofa graph lnE
' (4Marks) and also to find the number of components in a gaph. (6 Marks) 'h,qs
l!,&@ryD

lwrq,
pgftIrr
(6 Marks) fumE IC
PART B
lo aq-
!, n t"*-,
a
Fqtry
a. Design a presorting-based algorithm to find the distance between the 2 closest tst uW
numbers in an array of 'n' numbers. Compare the efficiency of this algorithm with Fe
hxoq
that of brute-force algorithm. (10 Marks)
hp
b. Construct AVL tree for the set of elements 5, 6, 8, 3, 2, 4, 7 . (6 Marks)
' hreq r
c. Apply Horspool's algorithm to search for the pattern BAOBAB in the text BESS F'mn
NEW ABOUT BAOBABS FErnAr
(4 Marks)
h*wq
Also, find the total number of comparisons made. [pmq
sr
frroq
For the input 30, 20, 56,75,31, 19, construct the open hash table. Find largest and
average number of key comparisons in a successful search in the table. (6 Marks)
t-
m lPsPqP

(4 Marks)
fa
b. Explain dynamic programming.
lt
(10 Marks)
l"
m ofthe first n cubes.
H

Et'e =iiEB&
Q-12 So/ved Quesflon Papers

c. Write the lormula to find the shortest path using Floyd's approach. Use
method to solve the following all pairs shortest paths problem. (10 I

[o €
g
3 -l
lz - -l An
l-
tt 7 o 1l s
l6 € 6 0lJ
\'

7.
a. Use Kruskal's method to find min cost spanning tree for the following graph
(6 \[r'il'fxqm a. Algorithm&
b. Prioritl'queri
Prioriq'quer
)essgnding 1

heap largesr
at inder 1 of
requires dele
For example.

0x
b. Write Huffrnan tree construction algorithm.
c. Draw the decision tree for the 3-elements insertion sort.
(8 Nfadsill
(6 ivlarlsill fT*T
8. After delete r

a. Differentiate between back tracking and branch-and-bound algorithm. (6 Ma*stl


0i
b.

c.
Draw the state space tree to generate first solution to 4-queens problem. with the firm
solution, generate another solution, making use of board's symmetry.
Explain P and NP problems.
(8 Ma*s[
(6 Marlst
[T'T
c. To find ffiD
Asymptotic r
52.
For the
-eir'€r
i. algorith
dia-eoca
ii. basic q
iii. the basii

(- -\f'
L worsst
/-,

:I:={
ir li ill

r1
rfl

l'li '

rh. Use Floyd's


(10 Markst
*il
)-: 5
Analysis and Design of Algoriths ::.: ao(mt
li-,o

Solutions for June-Juty 2009 -d-ri.B


?;? -:ns$
i

)i-€l Jf[.tilrfi
PART A s' ;,fl-Br
:E: a-ifrlr
L ;;r-qp ol l
mg graph. Its-rd, ?{JlW
(6 Markst a. Algorithm development process-Refer to Page No. 9-15, Figure No. 1.2. [-]s 3nl+ .lE
b. Priority queue implementation as unsorted array-Refer to Page No. 26. ::a5eur g
Priority queue can be implemented efficiently using heap data skucture. e-; 3 s ]l*trf
a*: a".lr"s&
Descending priority queue can be implemented using max heap. In a max
U ar'rbixulrr
heap largest element (element with highest priority) can always be found r'.ri,o, orup
at index 1 of the array. Hence, the delete operation of the priority queue lc€ r.+ilur
requires deletion of the element at index 1. q se]|:orruqp
l s/ar0W
For example, consider the heap dt8g:
Ftl lo uq
(8 Marks)
0r234
, 3rltlll,tllll,t
10 9 8 5 6 7 3
(6 Marksl f1u-:caP
p.; rrr**,
After delete operation, the heap looks like F t'; t*
lm. (6 Marks) )n-'::erp
gm. With the first
0123456 h-- ru -,,

fro Srrurur
(8 Marks) 9 6 8 5 J 7
ry-- iear, ,olm
(6 Markst bq",c4 eq
c. To flnd GCD (60, 2$by applying Euclid's formula-Refer to Page 4-5. f :t -,oqre

2. o*""w
fo"
Xdlqut
a. Asymptotic notation used in algorithm analysis-Refer to Page No. 50- Fr
pef
feaU
52.
iar.'o
b. For the given algorithm be- a; "*
mq

tur
i. algorithm checks if the given rnatrix is symmetric over the main "oaw
a-.=au
frs
diagonal.
Pc - wen
ii. basic operation is comparison lr:,, sm
iii. the basic operation is executed (in the worst case) f==qw
l-*
'

cLworssl
-.:I"-2Yn-t I har
Li=O L.i_i+t'
-#
: Xt,, - t) - (i +.1) + 1l
t=(,
H
tr-:

-;a StEEs
Q-14 Solved Quesfrbn papers
Q-15 So/vedeues

: Ia-r-i) _N
i=0 _h{
_M
: Ii=Jr,-,r-I,=^" when I::
-l

I
:(n-l)
Ir-I'
i=0 i=0
_I
_,
-[
:(n- l)[(n-2)-0+ rr- M(n) -3
[E:zler] a
J.
e0
:(n-1)(n-l)- (n-2)(n-l)
a. Quick smr
euick sat
:(n-rtlrn-l;-(n-zl1 b. Algoriilm
L' 2.l c. Exhausiw
:(n- qlzn-z-n+21 +.

a.
Lzl Inasetofl
comparisu
:(n-1) /l) i. keyno
\2)
I
ii. sorer
The averagl
_ n(n-l)- (n')
. ,. i. Sm
,
C-E
: l" n2e{n2)
1
iv. The efficiency class is quadratic.
v. The algorithm can be further improved. ii. Unq
For the given recursive argorithm to compute the sum C,E
of first n cubes, the
basic operation is multiplication. Let M(n) be the
number of times the
basic operation is executed. Then
M(n):M(n-l) +1+l+l forn> I b. DFS algmirt
to cumpute to multiply S(n_l) c, Applicatimr
S(n-l) bynrn*n
M(l):0
Solving the relation, we have
M(n):M(n-l)+3
5.
= [M(n *2)1+Z+S
: M(n - 2)+3+3 Presorting{c
: [M(n - 3)+3]+3+3 numbers in a
brute-forec at
Q-14 Solved Quesfrbn papers
Q-15 So/vedeues

: Ia-r-i) _N
i=0 _h{
_M
: Ii=Jr,-,r-I,=^" when I::
-l

I
:(n-l)
Ir-I'
i=0 i=0
_I
_,
-[
:(n- l)[(n-2)-0+ rr- M(n) -3
[E:zler] a
J.
e0
:(n-1)(n-l)- (n-2)(n-l)
a. Quick smr
euick sat
:(n-rtlrn-l;-(n-zl1 b. Algoriilm
L' 2.l c. Exhausiw
:(n- qlzn-z-n+21 +.

a.
Lzl Inasetofl
comparisu
:(n-1) /l) i. keyno
\2)
I
ii. sorer
The averagl
_ n(n-l)- (n')
. ,. i. Sm
,
C-E
: l" n2e{n2)
1
iv. The efficiency class is quadratic.
v. The algorithm can be further improved. ii. Unq
For the given recursive argorithm to compute the sum C,E
of first n cubes, the
basic operation is multiplication. Let M(n) be the
number of times the
basic operation is executed. Then
M(n):M(n-l) +1+l+l forn> I b. DFS algmirt
to cumpute to multiply S(n_l) c, Applicatimr
S(n-l) bynrn*n
M(l):0
Solving the relation, we have
M(n):M(n-l)+3
5.
= [M(n *2)1+Z+S
: M(n - 2)+3+3 Presorting{c
: [M(n - 3)+3]+3+3 numbers in a
brute-forec at
:)r !;J
tll; e
Q-15 Solved Quesfron Papers

: M(n- 3)+3+3+3
Solved Question Papers Q-f 5
1,: :u
t "fft
: M(n - 3)+3*3
: M(n- i)+3*i ul si ll-c-!
c: l, apolaP t
whenl:n-1 pegJoFJ a.ii
: M(n{n-l))+3*(n-1) :lre Llns lo s
: M(1)+3*(n-1) Llol dli:.i,lt a
s ii-3o1t
:613*1n_l)
IeE ar:: Butr{t
M(n) :3n-3 lciLsrp oi Pe
e 0(n) laL",r, aUOP J
i'>s a.;: lau
\ '0
tt
t :au3eu-.r 10 ,

Quick sort algorithm-Refer to Page No. 12+-125. , _ = < .,-r4{


3u: a-i:dE, (
Quick sort to sort 5, 3, 7,9,8,2, 4,7-Refer to Page No. 126, Figure 4.3.
y, a.roiuqrel
b. Algorithm to find the height of binary tree-Refer to page No. 133.
''lsorouti:'a}
c. Exhaustive search algorithm to solve TSP-Refer to Page No. 109. dxa qlurtrr s
4. '' 1=nolr.rqrg
In a set of l3 elements, the elements that require the largest number of key relfsllE a
d!;ls 4;
comparison are
sAt ls uo!$
i. key not present in the list '3- :l;uiql
ii. some cases of successful searches i.lep
B i-"a,f
The average number of key comparisons made by binary search in P:suor*fi8
i. Successful searchk ,,.E,}:':!a+u
(r) =logz (n- 1) . };r1 ' :-re rorrs
Cu,,e
:logz(13 - 1) f--," ,*o
iro 3r..:.r'r-Llp6
:4-r iea, ,: rano
p a"c, aug, 1
-3 r rr
ii. Unsuccessful search lr> -.,: ::a1q
)6r pa=q sa
I
Co e (n) =logz (n + 1) Fi Ydl slrqJ-'
Ebes. the :logz(13 + 1) heru pretr al
imes the :4 l8,.*o ** s
tut *qP
b. DFS algorithm-Refer to Page No. 157-158. *P
Dia: eLi IlgS
>l c. Application of BFS-Refer to Page No. 159-160.
I
ps1--1ua,t
h= - z1q.
|
,-.-, srrq*i
Ie;aspefrfr
PART B lffi
i

u'ktg
i
5. i rlm
a. Presorting-based algorithm to find the distance between the 2-closest , !fr.4il

numbers in an array of 'n' numbers and its efficiency comparison with


brute-foree algorithm

tfe 3;E
Q-16 Solved Question PaPers

ALGORITHM Present Minimum Distance (A[0' "'n-1]) h(20)a


//Solves the problem of finding minimum distance
h(5q a
//between the 2 closest elements h(75)a
//Input: An arrayA[0...-n-1] of orderable elements h(31)l
/iOutput: Returns the minimum distance
h(le)i
Sort the arraY
Mindist:At1l -At0l lKq
fori€2ton-1 lo*,
if ( lAiil - Aii - 1l l)
0
mindist : lAtil - Ati - 1l
[T
I

return mi-ndist
worst cast efficiencY is
T(n)-T.on(n)+T..-(n) 19:
e O(nlog n) + 0(n)
e O(nlog n)
g(n2)'
The efficiency ofbrute-force algorithm is
The loc
o("= l)
This is because there will u" number of comparisons.
' 2-
This clearly shows that preorder-based algorithm is more efficient
compared to the brute-force algorithm to find the minimum distance.
b. All tree construction for the set of elements 5, 6, 8, 3,2,4,7-Refer to
Page No. 207. Key m
c. Horspool's algorithm to search the pattern BAOBAB in the given text
Shift table

Chracter (c) A B C o Z

Shift t(c) I 2 6 6 3 6 6 6

b. Dynn
c. Ford
275-
Soh*io

Kru&
Li$rL
6.
To construct open hash table for the input 30, 20, 56, 76, 31, 19 lE6
Assumption: Let the hastr function be lw"tr
4
h(k): (sum of digits of k)mod l0 lr"t-rl
h(30):(3+0) mod lO: 3 lr*,*r
J

l[r
I
{
So/ved Question PaPers Q-17 l# )
t
I
h(20) =(2+0) mod l0:2
h(s6):(s+6) mod 10: 1 ::: apoFP
h(75):(7+5) mod 10:2 la3;C]a, ar€

h(31):(3+1) mod 10:4 B€ -l1S io


-.!Ol Jllii\\
h(19):(1+9) mod 10:0
e! au:3u
c1rsrP c"i Pa!
3u\t ?f,GD /(
ai; -a'ro
!:'is
ii , t:aLBE;L +o E

L;3-:l3sl o
A an!'iiL.Fli
-/:5c'oLiula]
19 56 20 30 31
lxa qriil'n sa'
T .5.$aDiliqfal'
Sr?)l)PlfP fl'-
75 dr.i15:1'
The load factor = A: nlm )iA Io rlollE
Total number of keYs : ;- ;ri,qr,:
I i!.c+ JeSOr
Total number of cells ffi<
fficient fc:soa,u
De- : 6 :0.6: 60% , ' i -:::
P"''=e qcms
,aun

Refer to 10
i^--s :a iYe
Key comparisons in successful searches
is io :, 'rurPr

tErt F"u "a ra'o


x p:=rc. af, I
s=1+ 2 n [) _..lf,aH
p" c*sec sa
0.6
:1* [t>c: suut
2 Pa2 PueS I
p.L*l -u
: 1.03 '
to Page No' 265-266' .*
Pa'"+@F
b. Dynamic programming explanations-Refer L€: a!:ile4
flnd shortest path-Refer to Page No'
I

U. Formula for Floyd's ulp'o'"tt to fs:- +.ue


e+W
275. fc:
lu-:.l roul
to Page No' 276'Frgttte 8'7 '
Solution for the given graph-Refer le =a-w *

i' '*
i

7.
Kruskal,salgorithmtofindthecostforthegivengraph. dp b*J
a.
List the edges in a sorted order' itm
i ,rrsn
be cd de cf bf
Edges ab bc ef af ce

7 8 9 10 11 t3 l4 20
Weieht 6 7
x x x x
Invertion status
4 5
lnversion order I z -')

f;fB 3,n I is
Q.18 So/ved Quesfbn papers

USN

I-fIl-
06cs63
Total cost:39
b. Huffinan tree conskuction algorithm-Refer
to page No. 31r-312.
Fourth S
c.
l;:*t*
tree for 3-elements invertion sort-Referto page
No. 369, Figure 200y
Time: 3 hrs
8.
Note: 1. Ansm
a. Difference between back hacking and branch-and-bound
argorithm.

(l) Non-optimization problems (l) Optimization problems


(2) Employs depth first search (2) Employs best first search (not breath
traversal first
search) traversal a. Explain {
(3) Requires a stack or use (3) We can use a heap to find the
best node (the chart.
recursion node with the best solution seen so far)
b. Define &r
statespace tree to generate first solution
to 4-queen problem*Refer to
i. Specir
PageNo. 396,Figtxe 12.2. ii. pathe a
Observe that, the solution is iii. Setsu
c. Write an a
a numbers"
a
a a. Prove ther
a If t1(n)eg1(
then t1(r
Another solution is its minor image
b. Write an al
algorithm!
a
c. Explain 6c
a
a
Iimits. Cq
a
a. Discuss hor
c. P and NP problem*Refer to page No. 373_374. Draw the tro
b. What is sffi
c. Write th" aI*

Вам также может понравиться