InsertSort 第一层循环结束条件修改

https://github.com/huihut/interview/issues/12#issuecomment-493734887
This commit is contained in:
huihut 2019-05-21 00:13:58 +08:00
parent 887e44531e
commit 3d7ce08037

View File

@ -16,7 +16,7 @@
void InsertSort(vector<int>& v)
{
int len = v.size();
for (int i = 1; i < len - 1; ++i) {
for (int i = 1; i < len; ++i) {
int temp = v[i];
for(int j = i - 1; j >= 0; --j)
{
@ -30,4 +30,3 @@ void InsertSort(vector<int>& v)
}
}
}