tags: I am a small white C ++
// Sort from left to right
#include<iostream>
#include<cstdio>
using namespace std;
int a[10]={2,52,45,63,98,25,12,36,5,47};
int main()
{
for(int i=0;i<10;i++){
for(int j=i;j<10;j++){
int b;
if(a[j]<a[i]){
b=a[j];
a[j]=a[i];
a[i]=b;
}
/ * Discover than a number of small numbers of A [i] * /
}
}
for(int n=0;n<10;n++){
cout<<a[n]<<endl;
}
return 0;
}
Output:
2
5
12
25
36
45
47
52
63
98
Think carefully, in fact, this is not the topicASC II code sortUpgraded version?
First, the minimum (large) element is found in the unsorted sequence, stored in the start position of the sort sequence The minimum (large) element is continued from the remaining unsained element, an...
Direct sequencing Generally, insertion sort are implemented using in-place on the array. The algorithm is described as follows: From the beginning of the first element, the element can be considered t...
...
Simply selecting the sorting and direct insertion sorting is the simplest two algorithms in the sorting algorithm, making a comparison more easily understood. ...
Thought: Each time you find the minimum coordinates, then exchange your location with the front. Code:...
Beginning with that sort sorting, have been wa, later wrote out a selection sort, AC a...