Created
December 13, 2017 08:32
-
-
Save dheshanm/c493d47c1ef7fc83cff414050d7133e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
procedure selection sort | |
list : array of items | |
n : size of list | |
for i = 1 to n - 1 | |
/* set current element as minimum*/ | |
min = i | |
/* check the element to be minimum */ | |
for j = i+1 to n | |
if list[j] < list[min] then | |
min = j; | |
end if | |
end for | |
/* swap the minimum element with the current element*/ | |
if indexMin != i then | |
swap list[min] and list[i] | |
end if | |
end for | |
end procedure |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment