References for the idea of recursive swapping algorithm: