Algo Mod1 Introduction
Algo Mod1 Introduction
ISSAM ALHADID
Modification date: 22-2-2019
• Algorithm Definitions
• Algorithm Characteristics
• Algorithm Components
• Algorithms Design Methods
• Algorithms Examples
• Algorithm’s Efficiency
A tool for solving a well-specified computational
problem
Computer B
execute ten million
instructions per Sec.
An algorithm is O(n3) requires 50 seconds to
solve a problem of size n=16. How long will
it take the algorithm to solve a problem of
size n=20 ?
Soln.
T(n) = C * n3 , where C is a constant …..(1)
T(16) = C * 163 = 50 Seconds……………(2)
If size = 20 ???
T(20) = C * 203 = ??? Seconds ………..…(3)
From eq.(2)
T(16)/ 163 = C
But T(16) = 50 …. Then
50/163 = C …
use the value of C in the eq.(3)
Where C = 0.01220703125
T(20) = 50/163 * 203 = 97.65625 Seconds
Time complexity depends on :
- Computational complexity (CPU, Memory…) ?!
- Algorithm Instructions