Algorithm Analysis: Ms. Uma. S
Algorithm Analysis: Ms. Uma. S
Ms. UMA. S
Time Space Trade-Off
Running time
Big Oh says that
0< =f(n) <= c.g(n) -- 1
f(n) – larger than n0
c = constant
n > n0
Example
f(n) = 3n + 2
g(n) = n
Then f(n) = O(g(n)) -- 1
f(n) <= O(g(n))------- 1
3n + 2 <= c.n
3n+2 <= 4n n0 > 2
Constant value = c
Write and sort an array
Teacher – executes – on his system – 16 bit computer – is
slow, takes two days.
Your – system –executes – enough faster – within a second.
C-- how much time PC takes to run that program
C – constant for every unique PC
If time takes O(n) , then multiply by C
Thisindicates in this PC, this algorithm takes this
time ---c.O(n).
C – Vary
Big Oh --- upper bound
Algorithm takes O(n) – maximum time
Minimum time is not known
Not much important