Programming is all about solving problems. How do you take a certain input and produce a certain output in response? Figuring 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:
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:
During this stage, you need to identify the type and values of the data being inputted.
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’s surname, which will be words.
Finally, there will be the student ID number selected from the list.
Figure 1 on the next slide shows the student surname being inputted into the system.
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 on the next slide.
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 whose surname matches the input. This is shown earlier in Figure 1.
The final output will be the contact details of the student selected from the list, shown earlier in Figure 2.
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.