Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void bubble_sort(int N, int* array); //сортировка пузырьком по возрастанию
- void bubble_sort(int N, int* array)
- {
- int tmp;
- int noSwap;
- for (int i = N - 1; i >= 0; i--)
- {
- noSwap = 1;
- for (int j = 0; j < i; j++)
- {
- if (array[j] > array[j + 1])
- {
- tmp = array[j];
- array[j] = array[j + 1];
- array[j + 1] = tmp;
- noSwap = 0;
- }
- }
- if (noSwap == 1)
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement