Skip to content
Computing · JC 1 · Algorithms and Computational Thinking · Semester 1

Introduction to Algorithms and Flowcharts

Students will learn to represent algorithms using pseudocode and flowcharts, understanding basic control structures.

MOE Syllabus OutcomesMOE: Algorithms and Computational Thinking - JC1

About This Topic

Searching and sorting are the 'bread and butter' of algorithmic study. This topic covers the mechanics of binary search, bubble sort, insertion sort, and quicksort. Beyond just memorizing steps, students must understand why certain algorithms perform better under specific conditions, such as nearly sorted data or very large datasets. This connects directly to the efficiency concepts learned previously.

In the Singapore context, these algorithms are the invisible engines behind everything from the National Library Board's book search to the logistics systems at PSA. By analyzing these standard methods, students learn to appreciate the elegance of recursive solutions and the trade-offs of iterative ones. This topic comes alive when students can physically model the patterns using tangible objects like weights or numbered cards.

Key Questions

  1. Construct a flowchart to represent a simple decision-making process.
  2. Compare the advantages of pseudocode versus flowcharts for algorithm representation.
  3. Explain how sequence, selection, and iteration are fundamental to all algorithms.

Learning Objectives

  • Design a flowchart to represent a given problem-solving process.
  • Compare the readability and efficiency of pseudocode versus flowcharts for documenting algorithms.
  • Analyze how sequence, selection, and iteration control the execution flow of an algorithm.
  • Create pseudocode for a simple algorithm involving conditional logic.
  • Evaluate the suitability of different control structures for specific algorithmic tasks.

Before You Start

Introduction to Programming Concepts

Why: Students need a basic understanding of what a program is and how instructions are executed to grasp algorithmic representation.

Problem Solving Strategies

Why: This topic builds directly on the ability to break down problems into smaller, manageable steps, a core skill in computational thinking.

Key Vocabulary

AlgorithmA step-by-step procedure or set of rules to be followed in calculations or other problem-solving operations, especially by a computer.
FlowchartA diagram that represents a workflow or process, showing the steps as boxes of various shapes and their order by connecting the boxes with arrows.
PseudocodeAn informal, high-level description of the operating principle of a computer program or other algorithm, using conventions that resemble natural language.
SequenceA control structure where instructions are executed one after another in the order they appear.
SelectionA control structure that allows a program to make decisions and execute different code blocks based on a condition (e.g., if-then-else).
IterationA control structure that repeats a block of code multiple times, either for a fixed number of times or until a certain condition is met (e.g., loops like for or while).

Watch Out for These Misconceptions

Common MisconceptionBinary search can be used on any list of data.

What to Teach Instead

Binary search requires the data to be sorted first. Hands-on modeling where students try to find a number in an unsorted pile using binary search quickly reveals why the logic fails without order.

Common MisconceptionQuicksort is always the fastest sorting algorithm.

What to Teach Instead

Quicksort has a worst-case performance of O(n^2) if the pivot is chosen poorly. Peer discussion about 'worst-case scenarios' helps students understand that 'average' performance is not a guarantee.

Active Learning Ideas

See all activities

Real-World Connections

  • Software developers at companies like Grab use flowcharts and pseudocode during the design phase to map out the logic for features such as ride-hailing or food delivery algorithms before writing actual code.
  • Logistics coordinators at Singapore Post might use flowchart-like diagrams to visualize and optimize delivery routes, considering factors like traffic conditions and delivery time windows.
  • Game designers use pseudocode to outline the behavior of characters or game mechanics, ensuring that actions like jumping or attacking follow a logical sequence and respond correctly to player input.

Assessment Ideas

Exit Ticket

Provide students with a scenario, such as 'Deciding whether to bring an umbrella based on the weather forecast.' Ask them to draw a simple flowchart representing this decision process and write one sentence explaining the role of selection in their flowchart.

Quick Check

Present students with a short piece of pseudocode. Ask them to trace the execution for a given input and write down the output. Then, ask them to identify which control structures (sequence, selection, iteration) are used in the pseudocode.

Discussion Prompt

Pose the question: 'When would you prefer to use a flowchart over pseudocode to explain an algorithm, and vice versa?' Facilitate a class discussion where students justify their choices based on clarity, complexity, and audience.

Frequently Asked Questions

Which sorting algorithms are required for the Singapore H2 Computing syllabus?
Students are typically expected to know Bubble Sort, Insertion Sort, and Quicksort. They should also understand Merge Sort conceptually. For searching, Binary Search and Linear Search are the core requirements.
How do I explain recursion in Quicksort simply?
Use the 'divide and conquer' analogy. Show how a large problem is split into two smaller ones, and then those are split again. Using a physical set of nested boxes can help students visualize how the function calls itself until the boxes are too small to split further.
What are the best hands-on strategies for teaching searching and sorting?
Kinesthetic activities where students act as the data elements are best. For example, in a bubble sort simulation, students stand in a line and 'swap' places based on their heights. This allows them to see the 'bubbles' of larger values moving to the end, making the abstract logic visible and easier to debug mentally.
Why do we still teach Bubble Sort if it is inefficient?
Bubble Sort is an excellent teaching tool for introducing the concept of nested loops and the idea of algorithmic passes. It serves as a baseline for students to appreciate why more complex algorithms like Quicksort were developed.