Problem Structure

Programming is all about solving problems. How do you take a certain input and produce a certain output in response? Being able to figure this out is the key to being a good programmer.

An important task in doing this is being able to identify the structure of the problem. You need to be able to break it down into its simplest form and solve each of these smaller problems.

In this lesson, we’ll learn about:

  1. Identifying the inputs for a problem.
  2. Identifying the processes for a problem.
  3. Identifying the outputs for a problem.
Media Attachments: Presentation Video

Identifying the Inputs

In order to understand the structure of a problem, and design an algorithm to solve that problem, you need to identify the inputs, processes, and outputs of it.

Imagine we’re designing an algorithm for your school’s system that tracks and monitors student data, including attendance, punctuality and recording homework marks. Such systems are known as Information Management Systems (IMS).

Using this system, the teacher will need to log in using a username and password.

The teacher will then enter a surname and be given a list of matching students from which they need to select the correct one. Once they select a student, the student’s ID will be used to display the full details.

You need to identify the type and values of the data. These can correspond to NOUNS in a problem statement e.g. “search by SURNAME” indicates a noun input.

First is a username and password, they will be a value as words or words and numbers.

Then there is the student surname, this will be words, this is shown in figure 1 below.

The input, output and process for searching the student database for the student with the surname ‘Smith’
Figure 1 – the input, output and process for searching the student database for the student with the surname ‘Smith’. Note how the output is a list of students with a matching surname.

Finally, there will be the student ID selected from the list, this is shown in figure 2 in the next section.

Further Thought

Last lesson you broke down the problem of creating a Student Planner.

Can you identify the inputs you’ll need for this?

2. Identifying the Processes

Processes are the actions being performed on the inputs.

Are there any calculations, or are there any other computational operations going on? These usually correspond to verbs in a problem statement e.g. “SEARCH by surname” indicates a verb process.

In our example, the username and password will be used to search the database to see if there is a match.

The student name will be used to search the databases to see if there are any matches.

The selected student ID will be used to search the database to retrieve the student details. This can be seen in figure 2 below.

The second search using ID to extract data about a single student from the database and retrieve full student details.
Figure 2 – the second search using ID to extract data about a single student from the database and retrieve full student details.

Further Thought

Last lesson you broke down the problem of creating a Student Planner.

Can you identify the processes you’ll need for this?

3. Identifying the Outputs

This is about what information will be presented to the user after the processing is complete. Much like with inputs, you need to identify the type and values of the information being outputted.

In our example, the first output will be either a confirmation or rejection of the teacher login.

The second output will be a list of students with a matching surname to the input. This is shown in figure 1 above.

The final output will be the contact details of the student selected from the list, shown in figure 2 above.

Further Thought

Last lesson you broke down the problem of creating a Student Planner.

Can you identify the outputs you’ll need for this?

Lesson Summary

So to summarise what we’ve learnt in this lesson:

  • To solve a problem with an algorithm, we need to identify the inputs, processes and outputs of the problem.
  • The inputs are about the data being passed into the algorithm. We must identify the type and values of the data being inputted.
  • The processes are calculations or any other operations being performed on data inputted.
  • The outputs are the information being presented to the user. We need to identify the type and values of the output.