Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 2.7:奇偶排序.c #344

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ebook/code/c/2.7:奇偶排序.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ void oddEvenSort(int *pData, unsigned int length)
{
//否则都不正常,交换
swap(*pBegin, *pEnd);
//---以下是我的修改
//因为交换后pBegin,pEnd指向的都是正确的奇偶数,即pBegin指向奇数,pEnd指向偶数
//因此我想增加下面的代码可以减少两次循环,不知道是否正确。
pBegin++;
pEnd++;
}
}
}
Expand Down