Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void bubble_iverson_2(int a[], int n) {
- int temp;
- int t;
- int board = n - 1;
- bool T = false;
- for (int i = 0; i < n && !T; i++)
- {
- T = true;
- t = 0;
- if (i < board)
- {
- for (int j = 0; j < n - i - 1; j++)
- {
- if (a[j]>a[j + 1])
- {
- T = false;
- temp = a[j];
- a[j] = a[j + 1];
- a[j + 1] = temp;
- t = j;
- }
- }
- }
- else
- {
- if (t == 0)
- {
- break;
- }
- else
- {
- board = t;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement