3 ms·
You technically do not need any swap space to swap two numbers. So algorithms which only use swaps could be implemented fully in place.
by davrosthedalek 7y ago
You technically do not need any swap space to swap two numbers. So algorithms which only use swaps could be implemented fully in place.
- utopcell 7y agowhile you can indeed swap in-place for PODs [1], this is not true for c++ objects. Also, in-place swapping is not sufficient for in-place sorting. [1] example: int a, b; a ^= b ^= a ^= b;