Head office, Rana Pratap Bagh, Delhi011 2721 1512+91 97116 99511

Science project idea

Sorting number cards by hand: bubble sort against selection sort

Eight number cards are sorted by two methods while counting comparisons and swaps. It shows how different algorithms reach the same answer with different amounts of work.

What it shows

Eight number cards are sorted by two methods while counting comparisons and swaps. It shows how different algorithms reach the same answer with different amounts of work.

The science

Bubble sort repeatedly compares neighbours and swaps them if they are in the wrong order, so the biggest number bubbles to the end each pass. Selection sort finds the smallest card in the unsorted part and swaps it into place, one swap per position. Both give a sorted list, but selection sort uses far fewer swaps, while the number of comparisons is similar. Counting steps is how we compare algorithms.

Materials

Cost: free. Many items come from home or from waste; spare parts such as LEDs, motors and wire are in the store.

  • Eight small paper cards numbered with random numbers from 1 to 50 (cut from old paper)
  • A table, a notebook and a pencil
  • A friend to count and check

Safety

This project uses safe, everyday materials. Still, read the rules below with a parent before you start.

Never use mains electricity: power models with cells, batteries or a low-voltage adapter. Sharp and hot tools, flames and lab chemicals need an adult or your teacher beside you. Keep magnets, button cells and small parts away from young children, and wash your hands after making.

All the safety rules

Step by step

8 steps. Do them in order, and test each part before you go on to the next. Write what you notice in a notebook as you go.

  1. Write numbers on eight cards, shuffle them and lay them in a row; copy the order into your notebook as the starting list.

  2. Make a table with columns Method, Comparisons and Swaps.

  3. Bubble sort: compare the first two cards and swap them if the left one is larger; add one to comparisons for each pair and one to swaps for each swap.

  4. Move one place right and repeat until you reach the end; this is pass 1 and the largest card is now at the right end.

  5. Repeat passes, stopping each pass one card earlier, until a whole pass has no swaps; write the order after each pass.

  6. Put the cards back in the original order for selection sort and scan all cards to find the smallest, counting comparisons.

  7. Swap the smallest with the first position (one swap) and repeat for the second position, the third and so on, until sorted.

  8. Compare the totals in your table, repeat with an already sorted row and a reverse sorted row, and note which cases are best and worst.

What you should see

Both methods end with the cards in ascending order. Selection sort uses at most 7 swaps for 8 cards while bubble sort uses many more on a shuffled row, but bubble sort finishes after a single pass on an already sorted row.

Viva questions

A teacher or a judge will ask how it works. Try to answer each question before you open it, then compare.

1What does one bubble pass do?

It moves the largest unsorted card to its place at the end.

2Which method uses fewer swaps?

Selection sort, with at most one swap per position.

3What is a comparison?

Checking which of two numbers is larger.

4Why is the sorted case interesting?

Bubble sort can stop after one pass with no swaps, while selection sort still scans everything.

Free ebook: Viva Questions for Science Projects

Take it further

Write bubble sort in Python with nested for loops and count its swaps with a variable, then check against your hand count.

Change one thing, measure what happens, and add a table or chart of your readings: that is what turns a model into your own investigation.

Free ebooks for this project

WhatsApp us