Faktorial
Kamus:
n,f,i
: integer
Algoritma:
Input(n)
f <-- 1
For
i ß 1 to n do
f <-- f * i
Output(f)
Operasi dasar
|
C(n)
|
C(5)
|
Cop
|
Input/<--
|
2n+2
|
2(5)+2
|
a
|
*
|
N
|
5
|
b
|
Output
|
N
|
5
|
c
|
Kompleksitas T(n):
T(5) = Cop * C(5)
T(5) = 12a + 5b + 5c
T(n) = Cop * C(n)
T(n) = (2n+2)a + (n)b +
(n)c
0 komentar:
Posting Komentar