Methods to develop algorithms

As a computer scientist it is important to be able to solve complex problems with computer systems. One of the key methods that can be used is to design and develop algorithms. This article explores how high level structured English language in the form of pseudocode or pseudo code as well as flow charts can be used to solve computational problems. These standard methods and techniques used to design algorithms are recognised within the computing industry, so developing the skills early in your career is an important aspect of being a good computer scientist. Let’s have a look at each of these methods to develop algorithms in more detail now.

Pseudo Code: Being able to produce, apply and understand pseudo code for computing problems is important as you may have to start from scratch or update an existing system along with supporting documentation. Pseudocode can be written in clearly structured English and it may need to be understood by technical and non-technical people so it’s important to make sure that this is considered in advance of outlining an algorithm using it.

  • Interpreting pseudo code: As previously mentioned you may need to look at existing algorithms defined using pseudocode for a current system. Having a good understanding of how pseudocode is used is important for this. In addition to this, system architects or analyst may define the system using pseudocode and developers will need to evaluate the code to calculate the expected inputs, outputs and processes of system or for specific functions of a system. Developers will need to look at the structure and logic of pseudocode against system requirements and build the code based on this. Existing pseudo code that defines algorithms can also be reviewed to suggest improvements to logical structures and processes within the system.
  • Developing pseudo code: Pseudo code can also be used to improve the effectiveness and efficiency of program code as it may be easier to look at a high level overview of the problem first to make sure all requirements are clearly defined before advancing to the coding stage. Having pseudo code developed can also make sure that more people within a business have an overview of how a system works and this can help identify potential pitfalls within the system and fix errors within code. Using standard structures and language for defining objects and elements within a system will make sure that all stakeholders are well informed by keeping things consistent.
  • Producing pseudo code: Having thought about the computational problem, you will need to produce the pseudocode that outlines the algorithm for the system or specific parts of it. Remembering that pseudocode is a common method of developing algorithms for a system, it’s important to be aware of what can be defined or represented within the pseudocode itself. Some of the things that can be defined our outlined are sequence, structure, operations, decisions and repetition.
    Sequence: The overall sequential flow of a program can be outlined using pseudocode. A high level overview could be of how the system goes from start up to close down without much thought for decisions and dependencies within the system. The step-by-step outline of sequential representations of repetitive tasks can also be outlined in clearly structured English to show the key outputs of the system to stakeholders in simple terms.
    Structure: The structure of a system can be outlined so that key components are identified. A hierarchical structure of the program can be outlined in pseudocode and clear indentation can be used to show the functionality and characteristics of features and functions within a system.
    Operations: Entry and exit points as well as key inputs and outputs of the system can be defined in pseudocode using recognised language that represents the algorithm. Examples of labels that can be used within the pseudocode are BEGIN and END to represent program start up and exit points, at these point key variables within the system can be loaded or cleared of values to make sure that the algorithm works as expected. INPUT or OUTPUT labels can represent states where the system is reliant on user commands such as a mouse click for input or a value update on screen as an output. PRINT, READ and WRITE can represent parts of a system that depend on file operations. An example of this could be a user form and a report that is created based on filling the form with data.
    Decisions: Common decision statements within an algorithm such as IF, THEN, ELSE or WHEN can be used to label and outline how certain elements of code are accessed based on the current state of the system. Consideration of all of the decisions that are made within the algorithm along with the data that defines these decisions can be clearly represented using pseudocode and therefore all scenarios can be outlined in advance to make sure that correct decisions are made.
    Repetition: Loops to cycle within an algorithm to repeat tasks or wait for inputs or changes in system data can be represented using high level language such as FOR, WHILE or REPEAT UNTIL. These keywords represent the repetitive element of the algorithm and other high level language to define the operation within the repetitive loops fully define the system.

Flowcharts: Another standard method or technique that can be used to develop algorithms is flowcharts. A flowchart shows a diagrammatic representation of an algorithm that gives a more visual representation of how things work. These can be particularly useful when communicating how the system may work at the early stages of a project to non-technical stakeholders. Like with pseudocode a computer scientist needs to be able to interpret, produce and development flowcharts to represents algorithms and system requirements. Standard symbols such as start, input, output, process, decision, connector and end are used. When creating flowcharts and using standard symbols. Become familiar with the types of symbols used in your organisation to make sure that everyone involved in projects has the best chance of seeing how algorithms or systems work. In the UK the British Computer Society does have a standard set of symbols that are used to create a flowchart, these are: Process (defines a set task), Decisions (represents the flow of the algorithm and can produce a number of different paths), Input/output (used as a wait state until an input is received or represents a system output), Connectors (lines or arrows to show the program flow) and Start/end (blocks to represent the start and end of the algorithm or system).

Our article on computational thinking looks at other problem solving methods to support the above and how some of the elements such as pattern recognition can be used in conjunction with algorithm design to make sure similar elements of a system are designed in a similar manner.

Note: Content is for educational purposes only. All material on this site is intended to be used as a guide only. Bookmark the permalink.