Hacker News new | past | comments | ask | show | jobs | submit login

You technically do not need any swap space to swap two numbers. So algorithms which only use swaps could be implemented fully in place.

while 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;

Applications are open for YC Summer 2020

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact