Skip to content

Computer Science · Ch 4 — Introduction to Problem Solving

Analysing the problem

4.2.1

Analysing the problem

The first step of problem solving is to understand the problem thoroughly before attempting any solution. This sounds obvious, but skipping it has a real cost: if we are unclear about what actually needs to be solved, we can spend effort building a program that, when finished, simply does not serve the purpose it was meant for.

What analysing involves

Analysing a problem means reading the problem statement slowly and carefully, and from it:

  • listing the principal components of the problem — the main parts or aspects the solution has to deal with, and
  • deciding the core functionalities that the solution must provide — what the program absolutely has to be able to do.

The pay-off: knowing inputs and outputs

A careful analysis answers two questions that shape everything built afterwards:

  • What inputs should the program accept? — the data the user or environment will supply.
  • What outputs should it produce? — the results the program must deliver back. …