Skip to content

Instantly share code, notes, and snippets.

@koehlma
Created October 26, 2014 10:51
Show Gist options
  • Save koehlma/5c22cf3b94ca255a8f29 to your computer and use it in GitHub Desktop.
Save koehlma/5c22cf3b94ca255a8f29 to your computer and use it in GitHub Desktop.
Quicksort:
A=[23, 11, 8, 4, 15], pivot=15
Partition:
Vertausche 23(0) mit 23(0)
[23, 11, 8, 4, 15] -> [23, 11, 8, 4, 15]
Vergleiche 23(0) mit 15(pivot)
Vertausche 11(1) mit 23(0)
[23, 11, 8, 4, 15] -> [11, 23, 8, 4, 15]
Vergleiche 11(0) mit 15(pivot)
b++
Vertausche 8(2) mit 23(1)
[11, 23, 8, 4, 15] -> [11, 8, 23, 4, 15]
Vergleiche 8(1) mit 15(pivot)
b++
Vertausche 4(3) mit 23(2)
[11, 8, 23, 4, 15] -> [11, 8, 4, 23, 15]
Vergleiche 4(2) mit 15(pivot)
b++
Vertausche 15(4) mit 23(3)
[11, 8, 4, 23, 15] -> [11, 8, 4, 15, 23]
Vergleiche 15(3) mit 15(pivot)
b++
[11, 8, 4, 15, 23]
A=[11, 8, 4], pivot=4
Partition:
Vertausche 11(0) mit 11(0)
[11, 8, 4] -> [11, 8, 4]
Vergleiche 11(0) mit 4(pivot)
Vertausche 8(1) mit 11(0)
[11, 8, 4] -> [8, 11, 4]
Vergleiche 8(0) mit 4(pivot)
Vertausche 4(2) mit 8(0)
[8, 11, 4] -> [4, 11, 8]
Vergleiche 4(0) mit 4(pivot)
b++
[4, 11, 8]
A=[], pivot=23
A=[11, 8], pivot=8
Partition:
Vertausche 11(0) mit 11(0)
[11, 8] -> [11, 8]
Vergleiche 11(0) mit 8(pivot)
Vertausche 8(1) mit 11(0)
[11, 8] -> [8, 11]
Vergleiche 8(0) mit 8(pivot)
b++
[8, 11]
A=[], pivot=4
A=[11], pivot=11
A=[23], pivot=23
10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment