Modified shell sort algorithm