//相邻两个数比较 交换位置
class Solution {
public:
void bubbleSort(vector<int> & v){
for (int i = 0; i < v.size(); i++){
for (int j = 0; j < v.size() - i - 1; j++){ //注意数组越界
if (v[j]>v[j + 1]){
int temp = v[j];
v[j] = v[j + 1];
v[j + 1] = temp;
}
}
}
}
};