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

Optimize method flip in SortUtils #1246

Open
BanQiaoGeXia opened this issue Mar 17, 2020 · 0 comments
Open

Optimize method flip in SortUtils #1246

BanQiaoGeXia opened this issue Mar 17, 2020 · 0 comments

Comments

@BanQiaoGeXia
Copy link

@BanQiaoGeXia BanQiaoGeXia commented Mar 17, 2020

static <T extends Comparable> void flip(T[] array, int left, int right) {
while (left <= right) {
swap(array, left++, right--);
}
}
Change 'left <= right' to 'left < right', can improve efficiency in some cases

BanQiaoGeXia pushed a commit to BanQiaoGeXia/Java that referenced this issue Mar 17, 2020
StepfenShawn added a commit that referenced this issue May 6, 2020
Optimize method flip in SortUtils #1246
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.