The Wayback Machine - https://web.archive.org/web/20200608230257/https://github.com/TheAlgorithms/Java/issues/1224
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

ShellSort Wrong #1224

Open
XmchxUp opened this issue Feb 13, 2020 · 2 comments
Open

ShellSort Wrong #1224

XmchxUp opened this issue Feb 13, 2020 · 2 comments

Comments

@XmchxUp
Copy link

@XmchxUp XmchxUp commented Feb 13, 2020

I tried your code, find error.
Please check it your code.

I think so this. (My english is bad,Sorry. I'm studying hard.)

      for (int i = gap; i < length; i++) {
            int j;
            T temp = array[i];
            for (j = i; j >= gap && less(temp, array[j - gap]); j -= gap) {
                array[j] = array[j - gap];
            }
            array[j] = temp;
        }
@mikegikas
Copy link

@mikegikas mikegikas commented Feb 13, 2020

it was working before you change it?
if i am correct you change the following lines
T temp = array[i];
array[j] = temp;

@DarthGrave
Copy link

@DarthGrave DarthGrave commented Feb 13, 2020

@XmchxUp XmchxUp closed this Apr 20, 2020
@XmchxUp XmchxUp reopened this Apr 20, 2020
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
3 participants
You can’t perform that action at this time.