initial commit

This commit is contained in:
2020-06-17 21:10:32 -05:00
parent dd38bde4de
commit b93ba9166b

View File

@@ -0,0 +1,23 @@
package Sorting;
public class WordSelectionSorter extends WordSorter{
public WordSelectionSorter(RandomWordFileReader reader){
super("selection sort", reader);
}
void sort(){
for(int i=0;i<words.length-1;i++){
int currentMinIndex = i;
for(int j=i+1;j<words.length;j++){
int comp = compare(words[currentMinIndex],words[j]);
if(comp>0){
currentMinIndex = j;
}
}
swap(words,i,currentMinIndex);
}
}
}