Function
S(input n:integer)→integer
Kamus
Algoritma
If (n=1)
Then
Hasil ←1
Else
Hasil←n + S(n-1)
Endif
Endfuction
Operasi Dasar Utama : Penjumlahan
T(n) = n + T(n-1) dimana n > 1
T(n) = 1 + T(n-1)
T(n) = 1 + 1 + T(n-2) = 2 + T(n-2)
T(n) = 2 + 1 + T(n-3) = 3 + T(n-3)
T(n) = ...
T(n) = n + T(n-n)
T(n) = n + T(0)
T(n) = n + 0
T(n) = n
Jadi, T(n) = n
Tidak ada komentar:
Posting Komentar