Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public string BubbleSort(int[] toSort)
- {
- string sortedArray = "";
- start = DateTime.Now;
- for (int lel = 0; lel < toSort.Length; lel++)
- {
- for (int i = toSort.Length - 1; 1 < i && toSort[i] < toSort[i]; i--)
- {
- int tmp = toSort[i];
- toSort[i - 1] = toSort[i];
- toSort[i] = tmp;
- }
- }
- stop = DateTime.Now;
- for (int i = 0; i < toSort.Length; i++)
- {
- sortedArray += toSort[i] + " ";
- }
- return sortedArray + (stop - start);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement