Langkau ke kandungan

    Sorting Station

    Sorting & Searching Umur 7–9

    Put lists in order with swaps, search them one by one or by halving, and find out why sorted data is so much faster to search.

    • Umur 7–9
    • 3 misi
    • Permulaan → Semakin mahir → Cabaran

    Computers spend a huge amount of time doing two jobs: putting things in order and finding things. At Sorting Station, Year 3 coders learn how a bubble sort swaps its way to a tidy list, and why a sorted list can be searched in just a few clever guesses.

    Apa yang akan dipelajari anak anda

    • Say whether a list is sorted, and in which order
    • Follow a bubble sort: compare two neighbours and swap them if they are the wrong way round
    • Describe a linear search and a binary search
    • Explain why a binary search needs a sorted list

    Bubble sort: compare and swap

    A bubble sort walks along the list looking at two neighbours at a time. If they are in the wrong order, it swaps them. After one walk the biggest number has “bubbled” to the end. Keep walking until no swaps are needed and the list is sorted.

    Two ways to search

    A linear search checks every item in turn — simple, but slow for a long list. A binary search looks in the middle of a sorted list and throws away the half that can’t hold the answer, again and again. Guessing a number from 1 to 100 takes at most seven guesses this way.

    Contoh soalan

    Berikut ialah beberapa soalan seperti dalam misi pertama. Bolehkah anda menjawabnya?

    1. 1. One swap puts 1, 3, 2, 4 in order. Which two numbers swap?

      • 3 and 2
      • 1 and 3
      • 2 and 4
      • 1 and 4
      Tunjuk jawapan

      Jawapan: 3 and 2. Swap 3 and 2 to get 1, 2, 3, 4.

    2. 2. To sort 3, 1, 2 from smallest to biggest, which number goes first?

      • 2
      • 3
      • 1
      Tunjuk jawapan

      Jawapan: 1. 1 is the smallest, so it goes first: 1, 2, 3.

    3. 3. What does sorting mean?

      • Deleting things
      • Counting things
      • Mixing things up
      • Putting things in order
      Tunjuk jawapan

      Jawapan: Putting things in order. Sorting arranges items in order, such as smallest to biggest.

    Tip untuk orang dewasa

    • Sort a shuffled hand of number cards using only neighbour swaps, and count the swaps.
    • Play “guess my number” with higher and lower, always guessing the middle.
    • Find a word in a dictionary by opening it in the middle and halving each time.