Advertisement
Guest User

Untitled

a guest
May 24th, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.48 KB | None | 0 0
  1. public string BubbleSort(int[] toSort)
  2.         {
  3.             string sortedArray = "";
  4.             start = DateTime.Now;
  5.             for (int lel = 0; lel < toSort.Length; lel++)
  6.             {
  7.                 for (int i = toSort.Length - 1; 1 < i && toSort[i] < toSort[i]; i--)
  8.                 {
  9.                     int tmp = toSort[i];
  10.                     toSort[i - 1] = toSort[i];
  11.                     toSort[i] = tmp;
  12.                 }
  13.             }
  14.             stop = DateTime.Now;
  15.             for (int i = 0; i < toSort.Length; i++)
  16.             {
  17.                 sortedArray += toSort[i] + " ";
  18.             }
  19.             return sortedArray + (stop - start);
  20.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement