diff --git a/Sorting/WordInsertionSorter.java b/Sorting/WordInsertionSorter.java new file mode 100644 index 0000000..b7a87a7 --- /dev/null +++ b/Sorting/WordInsertionSorter.java @@ -0,0 +1,22 @@ +package Sorting; + +public class WordInsertionSorter extends WordSorter { + + public WordInsertionSorter(RandomWordFileReader reader){ + super("insertion sort", reader); + } + + void sort(){ + String insertionValue; + for(int i=1;i=0 && compare(words[j],insertionValue)>0){ + writeToArray(words, j+1, words[j]); + j--; + } + writeToArray(words, j+1, insertionValue); + } + } + +} \ No newline at end of file