

#include
#include
#include
# define MAXSIZE 255
Bubble sort/* */
Void the BubbleSort (int a [], int n) {
Int I, j, temp.
Int flag=0;
for(i=1; i
Temp=a, [j].
A [j]=a, a + 1 bonus to [j].
A=\ [j + 1];
flag=1;
}
If (flag==0) return;
}
}
}
Int main () {
Srand (time (NULL));
Int length=10;
Int I, J;
Int k=1;
Int a [MAXSIZE];
for(i=1; i<=length; I++) {
A [I]=rand () % 101;
}
Printf (" before ordering: ");
For (I=1; i<=length; I++) {
Printf (" % d \ t ", a [I]);
}
Putchar (" \ n ");
Printf (" sorted: ");
A, the BubbleSort (length);
For (I=1; i<=length; I++) {
Printf (" % d \ t ", a [I]);
}
Putchar (" \ n ");
return 0;
}
CodePudding user response:
This should see face
Or back into the oven, you all have a good look at the bubbling, books or
The role of the flag you have a good research study
CodePudding user response:
In the BubbleSort, this flag do you use the ~ ~If (flag==0) return; Had the delete

CodePudding user response:
Indeed, the flag is completely useless, don't know what to do