sort swap with pointers