Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void BubbleSort(int[] array)
- {
- while (Sorted(array)==false)
- {
- for (int i=array.Length-1;i>=0;i--)
- {
- if (array[i]<array[i-1])
- {
- int x = array[i-1];
- array[i-1]= array[i];
- array[i]=x;
- }
- }
- }
- }
- static bool Sorted(int[] array)
- {
- for (int i=1;i<array.length;i++)
- {
- if (array[i]<array[i-1])
- {
- return false;
- }
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement