Menghitung_persegi
Deklarasi
I,j,n : integer
Algoritma
Input(n)
For i← 1 to
n do
For j← 1 to n do
If (i>j)
then
output(“*”)
else
output(“ “)
endif
endfor
endfor
Worst case, Best case, Average case
Tmin(n)
= n2
Tmax(n)
= n2
Tavg(n)
= n2 ≈ n
Tidak ada komentar:
Posting Komentar