bubblesort
DESCRIPTION
Kurze Einführung in Sortierverfahren anhand des Bubblesort AlgorithmusTRANSCRIPT
1
Christian Spannagel
Pädagogische Hochschule [email protected]
http://wiki.zum.de/PH_Heidelberg
Bubble Sort
2
Ordne!
3
Bubble Sort
procedure bubblesort (A: array)
n = array.length
do
swapped = false
for i = 1 to (n-1) do
if A [i] > A [i+1] then
swap ( A[i], A[i+1] )
swapped = true
end if
end
n = n – 1
while n > 1 and swapped
end
4
Weitere Sortierverfahren
• Insertionsort• Mergesort• Quicksort
siehe auch: http://de.wikipedia.org/wiki/Sortierverfahren