Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void DoBubbleSort(int[]arraytosort) {
- int endingpoint = 1,
- temp;
- bool issorted;
- do {
- issorted = true;
- for(int i = arraytosort.Length - 1; i >= endingpoint; i--)
- {
- if (arraytosort[i - 1] > arraytosort[i])
- {
- //swap the numbers around
- temp = arraytosort[i - 1];
- arraytosort[i - 1] = arraytosort[i];
- arraytosort[i] = temp;
- issorted = false;
- }
- }
- endingpoint++;
- } while (!issorted);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement