 

public class GnomeSort extends SortingAlgorithm implements Runnable{
    
    public GnomeSort(Integer[] toBeSorted, VisualizerFrame frame) {
        super(toBeSorted, frame);
    }

    public void sort() {
        int index = 0;
        while (index < getSize()) {
            if (index == 0 || compare(index, index - 1) >= 0) {
                index++;
            } else {
                swap(index, index - 1);
                index--;
            }
        }
    }
    
}
