Skip to content

Instantly share code, notes, and snippets.

@BetterProgramming
Created May 12, 2019 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BetterProgramming/7049cf43ccec68c442ad0c2630500ba1 to your computer and use it in GitHub Desktop.
Save BetterProgramming/7049cf43ccec68c442ad0c2630500ba1 to your computer and use it in GitHub Desktop.
const selectionSort = (nums) => {
checkLoopInvariant(nums, input, 0) //check during initialization
for (let i = 0; i < nums.length - 1; i++) {
checkLoopInvariant(nums, input, i) //check at each iteration
}
checkLoopInvariant(nums, input, nums.length) //check at the
return nums
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment