Optimized Gnome Sort