_Trinity (The Matrix)
What is an Algorithm?
An algorithm is an ordered sequence of steps guaranteed to solve a specific problem. If that sounds like the definition for a computer program...it is! Programmers develop algorithms when they develop computer applications. It's a crucial problem-solving skill that demands critical thinking. It takes time, and many programs, to become truly proficient but there are procedures that can help with creating an algorithm:
How to Write Algorithms
What is an Algorithm?
An algorithm is an ordered sequence of steps guaranteed to solve a specific problem. If that sounds like the definition for a computer program...it is! Programmers develop algorithms when they develop computer applications. It's a crucial problem-solving skill that demands critical thinking. It takes time, and many programs, to become truly proficient but there are procedures that can help with creating an algorithm:
How to Write Algorithms
1. Understand the problem.
- read and re-read the problem.
- analyze the problem and express it in your own words.
- break it down into smaller steps (in order).
- begin thinking about the data inputs required and the variable names you will use.
- if the program performs any math, work out a few examples with pencil and paper.
- finalize what is needed to solve the problem (called the requirements).
- Note: the key skill needed here is attention to detail. Be meticulous.
- use a pencil and ordinary English words to describe each step.
- choose suitable variable names for data and use them in your pseudocode.
- make sure your steps are in the correct sequence. We did say to use a pencil!
- add the RAPTOR flowchart symbols suggested by your pseudocode, in the same order.
- delay configuring any symbol until all symbols have been added.
- starting at the top, double-click each RAPTOR symbol to configure it.
- configure using the same variable names you chose for your pseudocode.
- add comments liberally to explain what the symbols are doing in the program.
- run the progam. If the program performs arithmetic, use small numbers for data.
- use a calculator if necessary to check the arithmetic and outputs.
- ask someone else to run the program to test assumptions made when configuring.
- ensure that the program meets the problem requirements by running it repeatedly.