Uploaded by vishnupriya v

CS611

advertisement
22"
poof by idtion
A
symptotic
3
BigO:T(n) <c.f(u)
(upper)
2.
Big:F(n)1c.f(n)
Bigo:Botogen
sights
=
loglogezlogtnlogloo
LER
↑
c.
+
n
O(n) -acb
(n103b a>bx
b
0(n-log(n))
=
0
-
-> a
=
->
et
M
Binary search
simply
=>
divide into
a
arrays
the
choose
wick
awaytoeatfor
comparison
=>
I
E
in
points
form, abc-constants
T(n)
zlog(n"
RULE
=
T(n) Ea.T(v/b)
all to same
bases.
niz
logus,
oglogn,
them
between
distance
Sm smallest
sides
↳architter
thereare
log linear squad (poly
Bring
hypothesis-dm=Right subproblem
Induction
spree Assume
(lower)
logn 2m,
Left subproblem
5=
Base Cas
1.
inversions
cating
Dance
problems
=> 0
(1)
largest
->
smallest
Naive:O(n)
Gap
4/2
->
->
T(n)
2
=
n/2
sconcept
T(4/2) 0(n)
+
-
a compare
-
A
Trees:
Recurrence
-
depth:log
-Tree
level when
in
T(n()
->
)
->
SqutT(u) vT(rn)
n
Cetn
2k
=by 2k
into
get
I
->
nlog logi
=>
=
sum
->
->
=
ene
1
+
EE,
2
↳ subst with val
U
↑
T(n) T(n-1)
=
nuo's:
of
nz
log(n)
logn
nz
-
=
=
nx
op away result
for in-I
=
while stack
i1
=
f(x)
9
f(x)
um
not empty
A [i]
wes,
=
0(urn)
>
-
<
pop()
tall
append (tall)
break
else
=
stack.pop()
u2
=
if stack empty.
result,
(n)
path
once
0 (n2)
instead
result,
stack,
reverse
tall:stack.
if
a
if stack empty.
stack
create
masterthe
=
-> 0
[1...n]
U
Si
used to traverse
append [-1
append [-1
pud [A[i]]
return result, reverse
Mult
Dial
3
T(4/z)
0(n)
+
Download