Skip to content

Instantly share code, notes, and snippets.

@vaidehijoshi
Created May 29, 2017 05:25
Show Gist options
  • Save vaidehijoshi/932fad61bb03edcaa6a877d181751a99 to your computer and use it in GitHub Desktop.
Save vaidehijoshi/932fad61bb03edcaa6a877d181751a99 to your computer and use it in GitHub Desktop.
> selectionSort([33,2,52,106,73]);
> comparing 33 and 2
> comparing 2 and 52
> comparing 2 and 106
> comparing 2 and 73
> swapping the number 2 for the number 33
> numbers currently looks like: 2,33,52,106,73
> comparing 33 and 52
> comparing 33 and 106
> comparing 33 and 73
> numbers currently looks like: 2,33,52,106,73
> comparing 52 and 106
> comparing 52 and 73
> numbers currently looks like: 2,33,52,106,73
> comparing 106 and 73
> swapping the number 73 for the number 106
> numbers currently looks like: 2,33,52,73,106
>> (5) [2, 33, 52, 73, 106]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment