What is the Price of Your Luck? — Cracking Computer Search Costs with the "Token Game"

Searching for keywords, numerical values, or specific data is the foundation of many computer applications—whether checking a bank balance, locating a file on a laptop, or running a Google search.

We expect computers to find answers instantly. Nothing is more frustrating than seeing the loading icon on our screens.

However, computers are actually quite simple; they can only look at one piece of data at a time. Imagine if a computer had to read through billions of web pages one by one to find what you wanted—you would be waiting forever.

To avoid this, computer scientists invented different "Search Algorithms."

Today, we will transform abstract "computational time" into something children value most: "Tokens" (Allowance/Currency). Through a game that costs "money" to play, children will personally experience how expensive "luck" is when facing messy data, and how "logic" saves money when data is organized.

Phase 1: Random Search(The Risk of Bankruptcy)

First, we will simulate the frustration a computer faces when processing an "Unsorted List." In Computer Science, we call this "Sequential Search."

  1. The Mission Setup:
    • Prepare 15 cards. Draw an animal on one side and write a number (1–15, but not in order) on the other.
      Place the cards in a row with the animal side facing up.
    • Key Props : Give the child 10 marbles (or candies/tokens).
    • The Rules: "I am looking for the number 4. For every card you flip over to check, you must pay me 1 marble. If you run out of marbles before finding it, you lose."
  2. The Cruel Experience:
    • The child begins flipping cards. Because the animal pictures offer no clue to the numbers behind them (the data is unstructured), they have no logic to rely on. They can only guess randomly or flip from start to finish.
    • Scenario A (Lucky): They find it on the 1st card! The child is happy: "I only spent 1 marble!"
    • Scenario B (Unlucky): They don't find it until the 13th card.
    • Real-life Analogy: This is like lending a book to a friend but forgetting which of these 6 houses they live in. Because you don't know who has it, you have to knock on every single door to ask.
  3. Guiding Reflection:
    • "Wow, you almost went bankrupt there! If we doubled the amount of data (30 cards), how much time do you think it would take you?"
    • The Answer: On average, if the data doubles, the search time doubles. This is the price of relying on luck (Linear Complexity).

Phase 2 : Sorted Search( The Victory of Logic)

Now, let's let the child experience the power of "organized data" by introducing "Binary Search."

  1. The Adjustment:
    • This time, use number cards from 1–100, but arrange them in order from smallest to largest (Sorted).
    • The goal is to find the number 52.
  2. The New Rules:
    • "We have 15 different numbers, one on each card. Although you can't see them, this time they are lined up in order from smallest to largest. The numbers are between 1 and 100."
    • "You still only have 10 marbles. However, because the cards are sorted this time, when you flip a card and it's not the number I want, you are allowed to sweep all the cards that couldn't possibly be the answer into the trash!"

Phase 3: The Great Cost-Saving Battle

  • Parental Scaffolding: "Since every marble is precious, which card do you want to flip to help you delete the most cards at once?"
  • The child usually points to the middle.
  • Parent Action:
    • Flip the selected card to reveal the number.
    • If the number is correct, the game ends.
    • If the guess is wrong, remove that card plus all cards that contain impossible numbers (i.e., if the target is 52 and you flipped 40, remove 40 and everything to its left).
  • 引導思考Guiding Reflection:
    • Repeat the process: "Flip -> Compare -> Eliminate Half." This is called "Divide and Conquer."
    • "How many guesses did it take to find the number?"
    • "How can you guess in a way that removes the most cards at one time?"

Phase 4: Concept Connection

Why is Google So Fast?

  1. The Leap in Efficiency:
    • The progression from "Sequential Search" to "Binary Search" demonstrates the importance of choosing the correct algorithm.
    • The progression from "Sequential Search" to "Binary Search" demonstrates the importance of choosing the correct algorithm.
  2. Real-world Application:
    • This is why computers can handle massive amounts of data. By constantly "cutting in half," they turn enormous tasks into trivial ones instantly.

Phase 5: Debug & Challenge

When to Use Which Move?

We need to ensure the child understands the context for application, rather than just memorizing the method.

  • Question: "Since 'cutting in half' saves so many marbles, why didn't we use it in the first level (the animal cards)?"
  • Guided Answer: "Because the cards in the first level were messy (Random Order)! If they aren't sorted, you have no idea which side the answer is on, so you can only guess."
  • Summary:
    • When data is messy: You must use Sequential Search, even though it might take a long time.
    • When data is sorted: You must use Binary Search to use logic to eliminate wrong options.

Teaching Observation Guide (Clinical Interview Guide)

Observation PointLess Effective ResponseMore Effective Scaffolding
When the child tries to use strategy in Level 1 (Unsorted)"There's no logic here, just guess randomly.""Do you think picking the middle card makes it easier to win? Since they are arranged randomly, is the probability of winning the same for the middle card vs. the side cards?"
When the child guesses the wrong side in Level 2 (Sorted)"Wrong. 52 is bigger than 40, you should keep the right side.""Wait a second. If we throw away the right side, what happens if 52 is hiding there? Let's check again: Is 52 bigger or smaller than 40?"
Discussing "Prediction""You guessed right 5 times.""If these 6 houses belonged to your friends, how many doors do you think you'd need to knock on to find the book? Why do some people say 1, and others say 6?" (Discussing Luck vs. Average Case)

Reference :csunplugged earching algorithms