Created
February 9, 2013 12:53
-
-
Save Roconda/4745216 to your computer and use it in GitHub Desktop.
reversed selectionsort
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void SelectionSort() | |
{ | |
int HuidigePositie, HuidigeWaarde; | |
for (int I = 0 ; I < collection.Length - 1 ; I++) | |
{ | |
HuidigePositie = I; | |
HuidigeWaarde = collection[I]; | |
for (int J = collection.Length-1 ; J > I ; J--) | |
{ | |
if (collection[J] < HuidigeWaarde) | |
{ | |
HuidigePositie = J; | |
HuidigeWaarde = collection[J]; | |
} | |
} | |
collection[HuidigePositie] = collection[I]; | |
collection[I] = HuidigeWaarde; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment