implemented gnomeSort