Skip to content

Conversation

@diegopetrucci
Copy link

This code doesn’t actually work and I can’t understand why. Anyone can
help?

This code doesn’t actually work and I can’t understand why. Anyone can
help?
@diegopetrucci
Copy link
Author

The title is incorrect: this is the solution for shell sort.

@diegopetrucci diegopetrucci changed the title Solution for assignment #3 - Insertion Sort Solution for assignment #3 - Shell Sort Dec 13, 2015
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You never generate the last gap value, which must always be equal to 1, because the last step of shell sort is an insertion sort. Try to change from

return number > 1 ? number : nil

to

return number >= 1 ? number : nil

or

return number > 0 ? number : nil

Thanks @matteomatassoni
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants