compute gnome sort