X Tutup
The Wayback Machine - https://web.archive.org/web/20201211085635/https://github.com/TheAlgorithms/Go/pull/112
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

create circle_sort.go #112

Open
wants to merge 1 commit into
base: master
from
Open

Conversation

@aakashdinkar
Copy link

@aakashdinkar aakashdinkar commented Mar 12, 2020

No description provided.

@aakashdinkar
Copy link
Author

@aakashdinkar aakashdinkar commented Mar 19, 2020

issue #2129

func circle_sort(arr[] int, start int,end int, swaps int)int{
s := start
e := end
mid := (end - start)/2

This comment has been minimized.

@brayo-pip

brayo-pip Jul 6, 2020
Collaborator

this is wrong, (end-start)/2 != (start +end)/2... I understand you are trying to avoid the overflow errors. The correct implementation would be mid := start+(end-start)/2 or mid := end-(end-start)/2

Suggested change
mid := (end - start)/2
mid := start + (end-start)/2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.
X Tutup