mirror of
https://github.com/huihut/interview.git
synced 2024-03-22 13:10:48 +08:00
InsertSort 第一层循环结束条件修改
https://github.com/huihut/interview/issues/12#issuecomment-493734887
This commit is contained in:
parent
887e44531e
commit
3d7ce08037
|
@ -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)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user