Module -
1
= What is
algorithm?
finite set of
1: Read A
steps to solve a
problem is known as
algorithm.
Step
Step2:
Step 3:
Read B
Sum: A + B
Print (sums
3 Aego
3) I each instruction should take
time to
get executed.
contain relevent
finite
Step 4: "It should
symbols,
instructions.
f
should contain
unambiguous
->
Analysis: whenever
you'll talk about an
algo, there will always be
analysis
↳
It is a
process of comparing cargos wnt e, Opace, etc.
I<
parameters to
compare algos
Analysis
Priory Posterior
after the execution
execution
of
Analysis before ·)
Analysis
"Independent of the hardware "It will
always give you relevent fined a
-we're
how
just finding outthe iteration,
is
amount time. of
hardware I so
many times a functh 3)
Dependent on a
particular
being called. Contains
uniform will notbe
uniform
C
value as
a there an
diff
hardware will
value
give diff.value
of TOS
gives approximate value of this
gives exact value
Asymptotic Notations
Mathematical time
representing complexity
↳ the
way of
i) Big-on (O)
t N cog(u)
n:input values ttime
7 fen): any furth
t
in
f(x) =
0g(n) (fen) =
order of g(u)]
* ↳
fewl ->
c.g(n)
[C30 n-KK50]
3
(Total
W
eg)
-
fen) = 2u-th time to solve a random
algo
Least upper
-> worst Case f Bound
H(u) 0CC
=
most) 2nEn
What is the
bigger value than 2n"th?
Upper Bound (At <
c.g(nY)
-
N
for of inputs
Big
all the values
on
always represent c3 >1,
=
n
this condition will always hold
3n2
upper bound values. &nith < value should be 3
↳ the
⑭
a
[Man time required to complete task =n= = On'th on for
a n can be written as
c3 = &n> 1
, ii) (t)
Big-Omega
fen) rg(u)
=
>
A
↓
flu) c.g(n)
f(u)
o
Eg:f(x) (n"
+n
=
-c.g(u)
24th XC.n" & Time Complexity Quest
:
c =
1
n> n2
&n-
n n' -
w
-> Best case ⑫
-> Lower Bound (At least
(Min. time required
f
to
task
complete a
O(v)
lower bound
Greatest
iii) eta (OS
Time Complexity Ques
tN Cg(n) c.g(n) <f(x) =
Ggog(n)
f(n)
F c.g(n)
Eg: flul = 2utth
2n" - 1n"+n < 3n2
21 2 22 3
= =
3
K r
0 (logen)
->
Average Case
->
exact time
We it will tell
generally Big the man time
-
use because
on us which
will
already include - $0.
Various Properties of Notations
Asymptotic
Reflenive (a a)
Symmetric asa Transitive
=
g(n) Ou(n)
f(x) Og(n)
= =
flu) = 0 h(n)
Big (0); flul -cg(n) I
Big; fen) - cgin)
⑦; cg(n) -> f(x) -c.((n)
In2 2uL 3n2
c.g(n)
flu) b =
a =
1
= What is
algorithm?
finite set of
1: Read A
steps to solve a
problem is known as
algorithm.
Step
Step2:
Step 3:
Read B
Sum: A + B
Print (sums
3 Aego
3) I each instruction should take
time to
get executed.
contain relevent
finite
Step 4: "It should
symbols,
instructions.
f
should contain
unambiguous
->
Analysis: whenever
you'll talk about an
algo, there will always be
analysis
↳
It is a
process of comparing cargos wnt e, Opace, etc.
I<
parameters to
compare algos
Analysis
Priory Posterior
after the execution
execution
of
Analysis before ·)
Analysis
"Independent of the hardware "It will
always give you relevent fined a
-we're
how
just finding outthe iteration,
is
amount time. of
hardware I so
many times a functh 3)
Dependent on a
particular
being called. Contains
uniform will notbe
uniform
C
value as
a there an
diff
hardware will
value
give diff.value
of TOS
gives approximate value of this
gives exact value
Asymptotic Notations
Mathematical time
representing complexity
↳ the
way of
i) Big-on (O)
t N cog(u)
n:input values ttime
7 fen): any furth
t
in
f(x) =
0g(n) (fen) =
order of g(u)]
* ↳
fewl ->
c.g(n)
[C30 n-KK50]
3
(Total
W
eg)
-
fen) = 2u-th time to solve a random
algo
Least upper
-> worst Case f Bound
H(u) 0CC
=
most) 2nEn
What is the
bigger value than 2n"th?
Upper Bound (At <
c.g(nY)
-
N
for of inputs
Big
all the values
on
always represent c3 >1,
=
n
this condition will always hold
3n2
upper bound values. &nith < value should be 3
↳ the
⑭
a
[Man time required to complete task =n= = On'th on for
a n can be written as
c3 = &n> 1
, ii) (t)
Big-Omega
fen) rg(u)
=
>
A
↓
flu) c.g(n)
f(u)
o
Eg:f(x) (n"
+n
=
-c.g(u)
24th XC.n" & Time Complexity Quest
:
c =
1
n> n2
&n-
n n' -
w
-> Best case ⑫
-> Lower Bound (At least
(Min. time required
f
to
task
complete a
O(v)
lower bound
Greatest
iii) eta (OS
Time Complexity Ques
tN Cg(n) c.g(n) <f(x) =
Ggog(n)
f(n)
F c.g(n)
Eg: flul = 2utth
2n" - 1n"+n < 3n2
21 2 22 3
= =
3
K r
0 (logen)
->
Average Case
->
exact time
We it will tell
generally Big the man time
-
use because
on us which
will
already include - $0.
Various Properties of Notations
Asymptotic
Reflenive (a a)
Symmetric asa Transitive
=
g(n) Ou(n)
f(x) Og(n)
= =
flu) = 0 h(n)
Big (0); flul -cg(n) I
Big; fen) - cgin)
⑦; cg(n) -> f(x) -c.((n)
In2 2uL 3n2
c.g(n)
flu) b =
a =