java-algorithms-implementation icon indicating copy to clipboard operation
java-algorithms-implementation copied to clipboard

optimize insert sort: reduce swap cost

Open liuhaozzu opened this issue 6 years ago • 1 comments

it's not necessary to swap the element everytime. It's better to treat it as selection sort here to reduce the swap cost.

By submitting this pull request I confirm I've read and complied with the below requirements.

  • [ ] I have read the Contribution guidelines and I am confident that my PR reflects them.
  • [ ] I have followed the coding guidelines for this project.
  • [ ] My code follows the skeleton code structure.
  • [ ] This pull request has a descriptive title. For example, Added {Algorithm/DS name} [{Language}], not Update README.md or Added new code.

liuhaozzu avatar Jan 09 '18 03:01 liuhaozzu

This is failing, please fix and I'll look at your suggestion

phishman3579 avatar Feb 21 '19 17:02 phishman3579