Computational Thinking, Algorithms, and Flowcharts
Data Abstraction
- Definition: Hiding unnecessary details and showing only the essential characteristics of an object or process.
- Key purpose: Allows a user to use a system without needing to understand its internal mechanics.
- Bicycle example:
- Boy knows only two actions—paddle to speed up, brake to stop.
- He is unaware of gear ratios, chain tension, or friction coefficients; these inner mechanisms are abstracted away.
- School-timetable example:
- Timetable shows periods, times, and subjects (weekly schedule).
- Omits granular information such as lesson objectives, assessment rubrics, or individual learning outcomes.
- Significance:
- By ignoring low-level specifics, abstraction enables creation of a general model that can later be translated into algorithms.
- Reduces cognitive load; makes problem-solving scalable across multiple contexts.
Algorithm & Algorithmic Thinking
- Algorithm: A finite, ordered list of step-by-step instructions that solves a problem.
- Must contain:
- Clear starting point.
- Clear ending point.
- Unambiguous, numbered steps in between.
- Planning stage:
- Employ computational thinking and decomposition to break a problem into sub-problems, then decide the order of re-assembly.
- Ubiquity & Applications:
- Power everyday digital tools (Google Maps routing, E-commerce product sorting).
- Present in real-life processes (recipe cooking, traffic-light sequencing).
- Multiple correct algorithms may exist for one problem; they can vary significantly in efficiency (time, memory, energy).
Basic Programming Constructs
- An algorithm in any programming language is built from only 3 universal constructs:
- Sequence: Linear progression—statements execute one after another.
- Selection: Branching logic—IF-THEN-ELSE decides which path runs.
- Iteration: Repetition—loops such as WHILE or FOR run a block multiple times.
- Loops are classified as:
- Finite: Predetermined end (e.g.
FOR i = 1 to 10). - Infinite: Continue until an external condition halts them.
- Finite: Predetermined end (e.g.
Properties of Algorithms
Every valid algorithm satisfies 5 criteria:
- Input specified – Requires at least one non-zero input value.
- Output specified – Produces at least one outcome/solution.
- Definiteness – Has an unambiguous beginning and ending.
- Effectiveness – Steps are sufficiently basic and guaranteed to yield the intended result.
- Finiteness – Completes in a countable number of steps.
Flowcharts
- Graphical tool to depict an algorithm’s logic with standardized symbols.
- Main symbols (Fig. 5.4):
- Oval: Start/End.
- Arrow/Line: Flow connector.
- Parallelogram: Input / Output.
- Rectangle: Process.
- Diamond: Decision (TRUE/FALSE or YES/NO).
- Advantages:
- Easier stakeholder communication; quicker error spotting.
- Acts as a bridge between problem statement and code (e.g., Scratch in Chapter 6).
Computational Thinking: Decompose | Pattern Matching | Abstraction
- Illustrated as an iterative funnel from BIG PROBLEM to MODEL (Fig. 5.2).
- Decompose:
- Split a complex task into manageable pieces.
- Bicycle maintenance example—examining chain, brakes, and wheels separately.
- Pattern Matching:
- Locate similarities among sub-problems.
- Sudoku analogy: spotting recurring numeric patterns in 3 \times 3 grids helps solve the whole 9 \times 9 puzzle.
- Abstraction (re-emphasized):
- Strip away distinct details; retain only attributes needed for a universal solution.
Example: Making Tea—Algorithm & Flowchart
- Textual algorithm (Steps 1–8):
- Take kettle.
- Fill with water.
- Turn stove ON.
- Wait for water to boil.
- Add tea leaves.
- Add milk.
- Tea is ready.
- Pour into cup.
- Flowchart interpretation (Fig.
5.5):
- Start (oval).
- Series of process rectangles for kettle, water, and stove.
- Decision diamond: “Has water boiled?”
- No branch: check gas pressure / continue waiting.
- Yes branch: proceed to add tea leaves & milk (input parallelograms).
- Tea is ready (output parallelogram)
- Process rectangle: Pour into cup.
- End (oval).
- Analysis:
- Waiting for boil encapsulates selection (decision) + iteration (possibly checking repeatedly).
- Ingredient addition represents input, while the change in water’s state illustrates transformation/process.
Real-World & Pedagogical Relevance
- Computational thinking fosters logical foresight—predicting future system states and mapping cause-and-effect.
- Applicable across age groups (Fig.
5.1), cultivating problem-solving literacy beyond computer science (e.g., scientific method, strategic games). - Ethical & practical angle:
- Efficient algorithms reduce energy consumption, impacting sustainability.
- Understanding abstraction warns against black-box bias—over-relying on systems without grasping inner limitations.
- Foundation for upcoming content: Flowcharts here seamlessly translate into Scratch blocks (next chapter), reinforcing the continuum from concept → diagram → code.