I need to find an algorithm to sort a deck of cards with THREE rules.
1. We can only look at the top 2 cards on the scrambled deck.
2. We may flip the two cards around if we wish
3. The top card goes to the bottom of the deck
I've tried recreating this situation physically with some cards, and I imagine it looks similar to bubble sort where we try to bubble the smallest number to the bottom of the deck, then the next smallest, and so on and so forth. I just can't seem to get it to work smoothly. So basically I'm looking for other methods of approaching this problem.