đ§ Week 1: Introduction to Computational Thinking
Week 1Computational Thinkingđ Qualifier
1.1 What is Computational Thinking? đ¤
Computational thinking is a problem-solving process that includes decomposition, pattern recognition,
abstraction, and algorithms. It's a way of thinking about problems that allows us to use computers
and other tools to help solve them.
đĄ Key Definition
Computational Thinking: A problem-solving methodology that breaks down complex problems into manageable parts and creates step-by-step solutions that can be implemented by computers or humans.
The Four Pillars of Computational Thinking
đ§Š
Decomposition
Breaking down complex problems into smaller, more manageable sub-problems.
Example: Planning a trip â Choose destination, book flights, find accommodation, plan activities
đ
Pattern Recognition
Identifying similarities and patterns within and between problems.
Example: Recognizing that sorting algorithms follow similar comparison patterns
đ
Abstraction
Focusing on essential features while ignoring irrelevant details.
Example: A map abstracts roads and landmarks, ignoring building details
âī¸
Algorithms
Creating step-by-step instructions to solve problems.
Effective problem-solving requires systematic approaches and methodologies.
The Problem-Solving Process
1
Understand the Problem
Read the problem carefully
Identify what you know
Identify what you need to find
Clarify any ambiguities
â
2
Plan Your Approach
Break down the problem
Choose appropriate strategies
Consider similar problems
Estimate the solution
â
3
Implement the Solution
Follow your plan
Work step by step
Keep track of progress
Be flexible if needed
â
4
Review and Reflect
Check your solution
Verify it makes sense
Consider improvements
Learn for next time
Common Problem-Solving Strategies
đ Trial and Error
Testing different solutions until finding one that works.
â Simple to implement
â Can be time-consuming
đ Make a List
Systematically listing all possibilities or options.
â Comprehensive approach
â May be overwhelming for large problems
đ¨ Draw a Picture
Creating visual representations to understand the problem better.
â Makes complex problems clearer
â Not suitable for all problem types
đ Work Backwards
Starting from the desired outcome and working towards the beginning.
â Efficient for goal-oriented problems
â Requires clear end goal
1.3 Algorithms & Pseudocode đ
Algorithms are step-by-step procedures for solving problems, and pseudocode is a way to describe algorithms using natural language.
What is an Algorithm?
đ¯ Clear and Unambiguous
Each step must be precisely defined with no room for interpretation.
đĨ Well-defined Inputs
The algorithm should specify what inputs it requires.
đ¤ Well-defined Outputs
The algorithm should specify what outputs it produces.
âšī¸ Finite
The algorithm must terminate after a finite number of steps.
â Effective
Each step must be simple enough to be carried out exactly.
Writing Pseudocode
Example: Finding the Maximum Number in a List
ALGORITHM FindMaximum
INPUT: A list of numbers called "numbers"
OUTPUT: The largest number in the list
STEPS:
1. SET max = first number in the list
2. FOR each number in the remaining list:
a. IF current number > max THEN
i. SET max = current number
b. END IF
3. END FOR
4. RETURN max
END ALGORITHM
Algorithm Examples
đ Algorithm: Getting Ready for School
Wake up
Take a shower
Brush teeth
Get dressed
Eat breakfast
Pack backpack
Leave for school
đ§Ž Algorithm: Adding Two Numbers
1. INPUT number1
2. INPUT number2
3. SET sum = number1 + number2
4. OUTPUT sum
đ Algorithm: Linear Search
1. INPUT list and target
2. FOR each item in list:
a. IF item equals target:
i. RETURN position
3. RETURN "not found"
đââī¸ Practice Problems
Problem 1: Decomposition Practice
Break down the problem "Organizing a birthday party" into smaller sub-problems.
Possible Decomposition:
Planning: Set date, create guest list, choose theme
Venue: Book location, arrange seating, decorations
Food & Drinks: Plan menu, order/prepare food, buy drinks
Entertainment: Plan activities, arrange music, games
Invitations: Send invites, track RSVPs
Setup: Arrange decorations, set up food, prepare activities
Problem 2: Write Pseudocode
Write pseudocode for an algorithm that determines if a number is even or odd.
Solution:
ALGORITHM CheckEvenOdd
INPUT: A number called "num"
OUTPUT: "Even" or "Odd"
STEPS:
1. SET remainder = num MOD 2
2. IF remainder = 0 THEN
a. OUTPUT "Even"
3. ELSE
a. OUTPUT "Odd"
4. END IF
END ALGORITHM
Problem 3: Pattern Recognition
Identify the pattern in this sequence: 2, 4, 8, 16, 32, ?
Solution:
Pattern: Each number is double the previous number (multiply by 2)