Steps in Problem-Solving and the Divide-and-Conquer Approach

Every day you solve problems without thinking much about it – planning how to get to school when the maxi taxi is late, or working out how to share the cost of a pizza among friends. In IT we solve problems in a more organised way, so that the solution can later be turned into a computer program. In this post you will learn the steps in problem-solving and how to use the divide-and-conquer approach to break a big problem into smaller ones.

Build on what you learned in Forms 1–3

These Lower School ICT posts cover the basics of this topic:

In this post:

  • The five steps in problem-solving
  • A worked example: planning a class fundraiser
  • Divide and conquer (top-down design)
  • Drawing a simple structure (top-down) chart

The five steps in problem-solving

The CSEC syllabus lists these steps. Learn them in order:

  1. Define the problem – say clearly what has to be solved. What information do you have (inputs)? What result is needed (outputs)?
  2. Propose and evaluate solutions – think of more than one way to solve the problem and look at the good and bad points of each.
  3. Determine the most efficient solution – choose the solution that works best, using the least time, effort or resources.
  4. Develop the algorithm – write the chosen solution as a set of clear, step-by-step instructions (in pseudocode or a flowchart).
  5. Test and validate the solution – check the algorithm with test data (for example, using a trace table) to make sure it gives the correct results for every case.

A quick way to remember them: Define → Propose → Choose → Develop → Test.

Worked example: the class fundraiser

Form 4 wants to raise money by selling doubles at lunchtime. The form teacher wants to know how much profit is made each day.

StepWhat the class does
Define the problemInputs: number of doubles sold, selling price, cost price. Output: the profit for the day.
Propose and evaluate solutions(1) Count the money in the box at the end of the day and subtract what was spent. (2) Record each sale and calculate profit = number sold × (selling price − cost price). Option 1 is quick but cannot show mistakes; option 2 is more accurate.
Determine the most efficient solutionOption 2 – it can be done on a computer each day with very little effort.
Develop the algorithm• Read number sold, selling price and cost price
• calculate profit
• display profit
Test and validateTry 40 doubles at $6 selling and $4 cost: profit should be 40 × 2 = $80. Check the algorithm gives $80.

Divide and conquer

Big problems are hard to solve all at once. Divide and conquer (also called top-down design or stepwise refinement) means:

  1. divide the problem into a number of smaller sub-problems;
  2. solve each sub-problem on its own; and
  3. combine the solutions to the sub-problems to get the solution to the original problem.

Example: preparing a three-course Sunday lunch. Instead of thinking of “make lunch” as one huge task, break it down: prepare the starter (callaloo soup), prepare the main course (stew chicken, rice and peas, macaroni pie), prepare the dessert (sweet bread or ice cream). Each of these can be broken down again – the main course becomes season the chicken, cook the rice and peas, bake the pie. When every small task is done, lunch is ready.

Another example from the syllabus is finding the exit in a hotel: find the nearest stairway sign, follow the corridor to the stairs, go down to the ground floor, then follow the exit signs to the door.

Prepare Sunday lunchStarterMain courseDessertSeason chickenCook riceBake pie
A top-down (structure) chart: the big task at the top is broken into smaller and smaller tasks.

Programmers use exactly the same idea. A school report-card program might be split into: enter marks, calculate averages, work out positions in class, and print the reports. Each part can be written and tested separately. You can see more on this in Introduction to Top-Down Stepwise Refinement.

Big programs are broken into smaller pieces that teams can build separately – divide and conquer in real life.

Video: Software Engineering: Crash Course Computer Science #16 – https://www.youtube.com/watch?v=O753uuutqH8

Try it: Which problem-solving step is it?

For each activity, choose the step of problem-solving it belongs to.

Deciding that the output must be the total cost of the class trip
Listing three different ways to collect money for the trip
Picking the cheapest and quickest way to collect the money
Writing the steps out in pseudocode
Running the steps with sample numbers to check the answer

Related

Related: Introduction to Top-Down Stepwise Refinement

Paper 1 practice (multiple choice)

Choose the best answer for each question. Try them all before you check.

1. Which is the FIRST step in problem-solving?
(A) Develop the algorithm
(B) Define the problem
(C) Test the solution
(D) Choose the best solution

2. Breaking a large problem into smaller sub-problems is called
(A) divide and conquer
(B) debugging
(C) compiling
(D) validation

3. Which step comes immediately AFTER “determine the most efficient solution”?
(A) Define the problem
(B) Propose solutions
(C) Develop the algorithm
(D) Test and validate

4. In divide and conquer, after the sub-problems are solved, their solutions are
(A) deleted
(B) combined
(C) compiled
(D) ignored

5. Checking an algorithm with sample data to see if it gives correct results is part of
(A) defining the problem
(B) testing and validating the solution
(C) proposing solutions
(D) dividing the problem

Show answers

1. B
2. A
3. C
4. B
5. B

Paper 2 practice (structured question)

A small parlour in Chaguanas wants a program to work out how much each customer must pay. Customers buy several items, and a discount is given when the bill is over $200.

(a) List, in the correct order, the FIVE steps in problem-solving. (5 marks)

(b) Explain what is meant by the “divide-and-conquer” approach. (2 marks)

(c) Using the parlour problem, identify:

(i) ONE sub-problem (1 mark)

(ii) ANOTHER sub-problem (1 mark)

(d) State ONE benefit of breaking a problem into sub-problems. (1 mark)

Total: 10 marks

Show answers

(a)
• Define the problem (1 mark)
• Propose and evaluate solutions (1 mark)
• Determine the most efficient solution (1 mark)
• Develop the algorithm (1 mark)
• Test and validate the solution (1 mark)

(b) A large problem is divided into smaller sub-problems that are solved individually (1 mark); the solutions are then combined to solve the original problem (1 mark).

(c)

(i) Read the price of each item and add up the bill (1 mark)

(ii) Check whether the bill is over $200 and apply the discount / display the amount to pay (1 mark)

(d) Any one:
• smaller problems are easier to understand and solve
• different people can work on different parts
• each part can be tested separately (1 mark)

Previous: Databases: Primary, Candidate, Secondary and Foreign Keys, Data Types and Relationships
Next: Defining a Problem with an IPO Chart: Input, Processing and Output
Back to CSEC Information Technology Notes

Syllabus link: This post is relevant to the CSEC® Information Technology Syllabus (CXC 30/G/SYLL 17), Section 7: Problem-Solving and Program Design, Specific Objectives 1 and 2 (“outline the steps in problem-solving” and “use the divide-and-conquer approach to decompose large everyday problems into smaller tasks”).

Attributions to media used in this post:

No third-party images are used in this post. Embedded videos are credited on YouTube to their channels.

Updates

2026/11/23

– Added Previous, Next and Back to course links at the end of the lesson.

© 2026 Vedesh Kungebeharry. All rights reserved.

Algorithm Solution: Using Computational Thinking to solve a Math problem


This is the solution and feedback for the problem blogged@ https://islandclass.org/2018/05/25/using-computational-thinking-to-solve-a-math-problem/

Solution

Algorithm:
1. Start
2. Start with N numbers
3. Determine the number of pairs, p = N/2
4. Find the sum of the first and last number , AL=  Fn+Ln
5. Calculate sum, Sum =  p* AL
6. Present the Sum.
7. Stop

© 2024 islandclass.org

Basic Computational Thinking Exercise

Exercise: block problem

3 blocks ABC rest on a desk. What are the steps to stack B on C on A?

After completing the exercise, continue:

Computational thinking allows for us to arrive at well defined steps based on the tool that we are using.

If a robotic Arm Were used the steps would be:

  1. Lift B
  2. Place B on C
  3. Lift C
  4. Place C on A

If we were directing a human, we might arrive at:

  1. Place B on C
  2. Place C on A

You may arrive at an entirely different solution:

  1. Place C on A
  2. Place B on C

Computational thinking allows for us to find General solutions to problems also. For example, if our problem was

“ N blocks rest on a table. Create a stack using all blocks. “

Using a robotic arm , our solution would be:

  1. Start with an empty space for a stack area on the table
  2. Lift an unstacked block from the table and place it on the designated stack area.
  3. If any other unstacked blocks rest on the table that are not in the stack,
    1. Lift an unstacked block
    2. Place the block on the stack
  4. Repeat Step 3 until there are no more blocks.

Note that:

  • This solution can solve multiple problems i.e n could be 0,1,6 etc.
  • The task always gets done regardless of the order of how the blocks are stacked.

© 2018 Vedesh Kungebeharry. All rights reserved

Using Computational Thinking to solve a Math problem

In this class, we use computational thinking to solve a mathematical problem.

Class Activity – Finding the sum of a range of numbers

Complete the following task in your ICT notebook showing all working

Task: Without the aid of your classmates, find the sum of all whole numbers from 1 to 200 inclusive.

(15 minutes)

Discovery: at least 3 different methods were found. One interesting solution was the addition of al the ones (1+11+21..+91 = 460) then all twos (2+12+22+…+92 = 470) etc.

Teacher Demonstration and Discussion

Practical: Observe students suggestions, pattern recognition, past algorithms, decomposition into sub problems

Demonstrate:

1+2+3+4+…………+197+198+199+200

Observe the sum of pairs from out going in always sum to 200.

Determine the number of pairs.

Note that the steps to solve this problem are:

  • Find the sum of the first and last numbers (1+200)
  • Find the number of pairs (200/2)
  • Multiply the results of 1 and 2.

Further Exersises and Discussion – Finding the Sum of a Range Of numbers

Homework:

  • Using a similar approach as shown above, write the set of steps to find the sum of numbers from 1 to 10
  • Write the steps to find the sum of any range of numbers from which form a complete number of pairs. (e.g 5 to 10)
  • Write the steps to find the sum of any range of numbers from which form an incomplete number of pairs. (e.g 5 to 11)

© 2018 Vedesh Kungebeharry. All rights reserved

Introduction to Computational Thinking

When solving a problem it is important to define what the problem is and identify the goal that must be achieved  to solve the problem.

In doing so we must identify the possible ways of achieving the goal using the information available.  To determine the possible ways, it is useful to produce a list of conditions that must be satisfied for the goal to be achieved.

Class Practical 1

In class demonstration: (Game: Wolf, Sheep, Cabbage)

Teacher Draws and Discusses the game with students with no prior information.

Homework

  1. Create a list of conditions which must be satisfied when for solving the problem
  2. Produce all possible, solutions to this problem

Class Practical 2

 

In this class we shall observe some logic games.

Preparation

  • Students are to divide their copybook page into two columns (page is folded vertically to quickly set up the scenario).
  • The first column is given the heading “Steps”.
  • The second column is unlabeled.

Wolf Sheep And Cabbage

 

 

  • 1 student is chosen at random to perform the task of solving the problem in the game. We call this student the “actor”.
  • All other students are instructed that they are not allowed to talk or assist during the exercise ( No blurting out “no” Prep students for  self control)
  • The game is explained to the actor.
  • Discuss the first actions with the actor. Silent students must write their first action, the main student takes his own action.
  • As consequences emerge, students and the actor write down the rules.
  • Every reset, write down the steps.

 

Discussion

-Are there any students with a different solution?

-Are there any rules for the boat?

-Are there different ways to start the problem?

In class Exercise

Write the steps to solve the problem.

 

Homework

Visit http://www.softschools.com/games/logic_games/ and play some of the logic games.

Write down some of the rules for the games that you have played. Use the following format:

Game nameGoal(s)Rules
Wolf, Sheep and Cabbage.Main goal: Get all items safely across the river

Secondary Goals: Do not lose any items to ‘eating’

 

 

·         Only one item is allowed in the boat

·         The sheep and wolf should never be left alone

·         The cabbage and the sheep should never be left alone.

   
   
   

 

In your notebook, complete at least 3 rows of the table. i.e the rules and goals for at least 3 logic games.

 Updates to this post

22nd Apr 2024: Added “When solving a problem….” up to and including Class practical 1. This class practical is meant or use in a classroom with no lab .

The previous class practical was renamed to Class Practical 2 and is meant for use in a Computer lab.

© 2018  Vedesh Kungebeharry. All rights reserved