The aim of this online activity is to sort a set of 8 playing cards randomly picked from a deck of cards based on the following rules:
- The cards need to be sorted in ascending order of their values. For the purpose of this task, an Ace will be the lowest value (1) whereas a King will be the highest value (13).
- In order reveal a card you need to click on it to flip it. However you will only be able to reveal two cards at a time.
- Should you decide to swap two cards, you will need to drag one of the card on top of the other card. Both cards will then swap position.
- If you believe a card is in position, you can tick the checkbox underneath it.
- If you believe all 8 cards are sorted, you can click on the “Check if cards are sorted” button. If they are in the correct order, from lowest to largest value, all 8 cards will be revealed.
- At anytime, you can start this task again with a fresh set of cards by clicking the “New Cards” button.
Your aim is to find a method (algorithm) that works for you and enable you to sort all the cards with a minimum number of swaps.
They are a range of different algorithms that can be used for a computer to sort a list of values. You can investigate some of the most widely used sorting algorithms using the following blog posts:
- Insertion Sort Algorithm
- Bubble Sort Algorithms
- Merge Sort Algorithm
- Quick Sort Algorithm
- Sorting Algorithms using Python
- Insertion, Bubble, Merge and Quick sort Algorithms
- Bubble Sort vs Insertion Sort
- Sorting Algorithms Visualisation