This is a kind of sorting algorithm that appears in some books of card tricks. Or is it a searching algorithm? It was also a programming task that was in an AQA GCSE Computer Science specimen paper, so I've made a Python version as well.

Sorting and searching really go together to help us find things. A binary search algorithm relies on the items being sorted, for example. Spending time sorting reduces the time you need to spend searching, but it might not always be as important. If you have ten books on your bookshelf then it might not be worth your time sorting them because a search will be simple. If you have 1000 books in a library, then it will be worth sorting them as a search through a larger number of books would be very time-consuming.

If you want to do the trick with actual cards the follow this algorithm:

choose any 21 cards from the pack

deal them into three columns, starting at the top-left, dealing left to right - i.e. deal across the top row, then across the second row, etc. - in front of a willing participant

ask the person to choose a card

ask the person which column the card is in, but to be careful not to point to the exact card

gather up the cards, collecting each column into a pile, and stack them so that the column selected in step 4 goes in the middle (also making sure not to shuffle the cards)

repeat steps 3 and 5 a further twice

the selected card will now be in the middle of the pack - remove the top ten cards and reveal the eleventh with a flourish!