Thursday, December 8, 2011

procedure selection sort dalam notasi algoritmik


Procedure SelectionSort (data : array[1..100] of integer; input n:integer)
{ Mengurutkan data [1..100] dengan algoritma Selection Sort.}

Kamus
i, j, temp, min : integer

Algoritma:
for i= 1 to n-1 do {notasi for}
min ← i
for j = i+1 to n do
if data[min] > data[j] then
temp ← data[j]
endif
endfor
temp ← data[i]
data[i] ← data[j]
data[j] ← temp
end for

No comments:

Post a Comment