DAA Solution
DAA Solution
DAA Solution
times
for lj: 2; j<n; j-je2) ’ loyn times
27*n =
Ofrlgn)
(b)
T(n) +
- T(n") +lgn' g
T(n)
-T(n)+
=T(2) +
yn. ..tgngn
7,t..-+
I+
Cosfast
(c)
T(n) n22 2+
423 +....
T(n) 2 + (3) +. .
We
AGp
n T(n)= 2. M
T(n) = 2n
Th) = (n)
(14) (()
(30) g4)
(6)
2(a
B-1re with mi ni mum =t
# Chid Pointn
2.
1 2. 2.t 2. (t -L)
2. 2t 2t2 2t(t-L)
2t
2+4 2+^(t-L)
I+ 2(t-1)+ t +
t- 1 (n-1)l2 lt-1)
t- 1
-1 < (n-1)
2
(n1)
M
E H PTX
delete H
M1
|M
E I
PT X
|SD| FG| KL NO
delebe &
MI
E I
K L
NO PS VW
|delete I
EM T X
2.
Right
Retdtion
5
R Racolong B
3
R
Righ
Roton
2 (c)
Maee - Henp Binomial Heep fibonacei Heap Trie
O(1) O(L)
Insut
Minimum O(1) O (n)
O(1)
Extrac t -Min
Uion O(yn)
O(2)
Decreae kt o1)
Delete
Olyn) Olu)
3.a)
Sucbig
UI C K S O RT
I C k
IC k )
R
Pt) T U ()
as(o, 8)
4 =p (o, o) as(õ,3) as(5, 8)
3 = P(o, 3) as(o,2) as (4,3) P(5,9)= 6 Qs(5,5)
1= Plo,) aste,o sa) as(,8)
X P(7,8) 9 ash) Äs(9,9)
Time Compiity
(c)
20 A
--lo
if
LCS (m, m) = MAX JLes(mtn) if xCm] # YCn]
(Les(m,n-)
|+ LCs (m-,n) f xCm] = Yn]
m= 0 or h=o
MAx LCs Cm-1J Lu7
Les [m] [n-]
|+.LCs Cm-L]Cn-] F x[m] = YCn7
1 1
X b 2 1 1‘
a 3 2 2 R 2.1
a, b
() A D
Jo x5 5x20 2oxlo loxs 5*40
M
5
3SsD 2 2
ISoo 22 So 3
3
12so
2
2ovD
S
Mltipleato =
Ordr ((ax(e*c)xo))*)
Items
I
Weigatlw) Paf-(P) Plw Ratie
I 1
I, '5 o.7L
I, 3 o. 33
W= lG
W =|G
P=o
Upto = 1749
W= W=|6
P lo P=o
Upto = 17 Upto = l6
W W=4
P= lo
Upto= l6
Anwer
5o 2s 1S
20 |2.
w(,s) if R=4
TSP(, A) =
MIN 3TSP (k, R-k) + w(o,k)}
TCn)= S2(2")
T(4, ie,c, o}) = 43
5
12
T(G,iD}) T(B,1<3) T(8,2 o}) T(D, i 8}) T(8, ic3) T(G i8})
25
(c)
NPH NPH
NP If TsP Prbdem
P Solued in P-tine P= NP= NPG
N PC