Thursday, December 8, 2011

procedure bubble sort dalam notasi algoritmik


procedure bubbleshort (m:array[1..20] of integer, input n:integer)
{Mengurutkan isi dari tabel m dari kecil ke besar dengan metode pengurutan bubble short}

Kamus
i,j:integer {variable perulangan}

Algoritma
for i = 1 to n-1 do
for j = i+1 to n do
if m[j]< m[j+1] then
temp ← m[j]
m[j] ← m[j+1]
m[j+1] ← temp
end if
end for
end for

No comments:

Post a Comment