Consolidated Question Patterns & Abstractions: Computational Thinking (Weeks 1-4)

This document synthesizes the core problem types and mental algorithms for the first four weeks of Computational Thinking. Use this to rapidly identify what a question is asking and which tools you need to solve it.

📚 Table of Contents

  1. Week 1: Procedural Thinking & Basic Operations
  2. Week 2: Advanced Logic & Finding Extrema
  3. Week 3: Procedures & Boolean Flags
  4. Week 4: Nested Loops & All-Pairs Comparisons

Week 1: Procedural Thinking & Basic Operations

  • Core Idea: Learning to read and write simple, step-by-step instructions (procedures) using the card-pile model. Focus is on counting, summing, and averaging.
Pattern #Pattern NameFrequencyDifficultyCore Skill & Abstraction
1.1Procedure InterpretationHighEasyAbstract: Identify what each variable does. Is it a Counter (+1) or an Accumulator (+ value)? A final Sum / Count step means it’s calculating an Average.
1.2Bug IdentificationMediumEasy-MediumAbstract: The most common bug is an incorrect loop instruction. Trace the repeat from Step N line. Does it incorrectly go back to an Initialize step, resetting the variables?
1.3Procedure Tracing (Execution)HighMediumAbstract: Become the computer. Create a “scratchpad” for your variables. Process one card at a time, updating the values on your scratchpad exactly as the instructions say.
1.4Data Sanity ChecksLowEasyAbstract: Check two things: 1. Data Type (is a number written as text?). 2. Value Validity (is a count negative? is a name a number?).

đź§  Week 1 Mental Algorithm: The Basic Loop

When you see a simple procedure that iterates through one pile of cards:

  1. Triage: It’s a basic loop for counting, summing, or averaging.
  2. Abstract & Act:
    • Find the Initialize step. This tells you the purpose of the variables.
    • Find the If statement. This is the filter that decides which cards to process.
    • Find the update step. This is the action (counting or summing).
    • Check the repeat from step. Make sure it doesn’t reset your work.
    • Check for a final calculation (like A / B).

Week 2: Advanced Logic & Finding Extrema

  • Core Idea: Using procedures to find the “best” card (minimum or maximum) and applying more complex conditional logic.
Pattern #Pattern NameFrequencyDifficultyCore Skill & Abstraction
2.1Finding Minimum/MaximumHighEasyAbstract: Recognize the “King of the Hill” pattern. A variable is updated only if a new card’s value is better (greater for max, smaller for min). Check the initialization value (0 for max, a large number for min).
2.2Interpreting Compound ConditionsHighMediumAbstract: Translate the pseudocode into an English sentence. A - B often means “Count of items with Property A that do not also have Property B”. If A and B counts the overlap.
2.3State Management & Re-initializationLowHardAbstract: Spotting a variable being reset inside a loop is the key. This means the procedure is processing data in groups (e.g., sentences, shopping trips) and the reset marks the boundary between groups.

đź§  Week 2 Mental Algorithm: The Min/Max Pattern

When you see a procedure that compares a variable to a value on a card and updates itself:

  1. Triage: It’s a min/max finding problem.
  2. Abstract & Act:
    • Check the Initialize value: Is it 0 or a very large number? This hints at max or min.
    • Check the If condition:
      • If NewValue > ChampionValue Finding Maximum.
      • If NewValue < ChampionValue Finding Minimum.

Week 3: Procedures & Boolean Flags

  • Core Idea: Organizing code into reusable blocks (procedures) and using True/False flags to track complex states.
Pattern #Pattern NameFrequencyDifficultyCore Skill & Abstraction
3.1Boolean Logic with FlagsHighMediumAbstract: Recognize the two main patterns for flags: 1. “For All” Check: Initialize flag = True, then set to False if you find a single failure. 2. “At Least One” Check: Initialize flag = False, then set to True if you find a single success.
3.2Using Procedures (Subroutines)HighMedium-HardAbstract: Trace the main procedure. When you see a Call Procedure(Input), pause, “run” the subroutine with that specific Input, get its Return value, and substitute it back into the main procedure.
3.3Interpreting Complex Nested ConditionsMediumMediumAbstract: Read the If/Else statements from the inside out. Determine the most specific condition first, then work your way up to understand what each branch of the logic is counting.

đź§  Week 3 Mental Algorithm: The Boolean Flag

When you see a variable being set to True or False:

  1. Triage: This is a flag problem, likely checking for “all” or “at least one”.
  2. Abstract & Act:
    • Initialize to True: The procedure is optimistic. It’s trying to prove a statement like “All items have this property”. It will only become False if a counterexample is found.
    • Initialize to False: The procedure is pessimistic. It’s trying to prove “At least one item has this property”. It will only become True if an example is found.

Week 4: Nested Loops & All-Pairs Comparisons

  • Core Idea: Mastering the “all-pairs” comparison pattern, which is essential for finding duplicates, pairs, and relationships between individual data points.
Pattern #Pattern NameFrequencyDifficultyCore Skill & Abstraction
4.1All-Pairs Comparison (Nested Loops)HighHardAbstract: Recognize the three-pile structure. The inner loop (While Pile 2 is not empty) is where the action is: it compares the current card X from the outer loop to every previously seen card Y in Pile 2.
4.2Nested Logic on a Single CardHighMediumAbstract: Differentiate this from the above. Here, the inner loop iterates over the attributes of a single card (e.g., the letters in a word). It answers a question about that one card only.
4.3Distinguishing Single vs. Nested LoopsHighMediumAbstract: The core question is: am I comparing each card to a fixed standard (e.g., class average) or to every other card? The first is a single loop; the second requires a nested loop.

đź§  Week 4 Mental Algorithm: The Nested Loop

When you see a procedure with three piles and loops within loops:

  1. Triage: This is an All-Pairs Comparison. The goal is to check every possible pair of cards.
  2. Abstract & Act:
    • Identify the card from the outer loop (X) and the card from the inner loop (Y).
    • Go to the If statement inside the inner loop. This is the core logic.
    • Translate that If statement into a plain English sentence describing the property of a valid pair. For example: If X.Country == Y.Country AND X.Medal != Y.Medal translates to “a pair of players from the same country who won different medals”.
    • The final result is the total count of such pairs.