The chapter I read explained the basics of pseudocode and a bit about algorithms. Pseudocode is a kind of code that closely follows the English language. It cannot be inputted into a computer for coding, but it can be translated into various coding languages that can be processed by a computer. It is a great collaborative form of coding that allows programmers of different coding languages to communicate and translate each other’s code. An algorithm is a string of code that creates a solution to a problem. It can be of any language, even pseudocode, therefore pseudocode and algorithms cannot be compared, as they have completely different meanings.
Another chapter I read explained how to solve problems. It talked about a man called George Polya, who was a mathematician that wrote a book about solving problems. Although the book was written before computers were a significant tool, it can be applied to computers and how they solve problems. According to Polya, the best way to solve a problem is by going through steps. The first step is to ask questions, or define the problem. The second step is to look for familiar things, trying to apply previous knowledge to solve a new solution. The third step is to divide and conquer, or to break up a large problem into manageable smaller ones. The final step is to use algorithms, which is, like mentioned earlier, a plan to create a solution to the problem.
Polya’s step plan was not intended for computers, but many parts of it can be applied to how computers solve problems. Computers also solve problems in steps. The first step is to analyze the problem. Just like Polya’s method, computers define the problem and try to use other knowledge to create an idea of the problem. The second step is to list the main tasks. This is the beginning of making the algorithm, and it is, in a sense, dividing and conquering, following Polya’s method again. In this step, the computer usually also restates the problem, like the first step. The third step is to write the remaining tasks. This is adding to the already beginning algorithm. The fourth step is to revise the code as necessary. Refine the code as much as possible, making it as good as possible. After this step, the algorithm should be done. The final, and most important step, is to actually test the algorithm to see if it works. After testing, you may need to go back to step four and refine the code some more, or it may work on the first try. Although Polya’s method is slightly different, it is, in many ways, very similar to how computers problem solve.
Write “What is your name?”
Read name
Set numberOfGrades to 0
Write “Enter five of your grades.”
While (numberOfGrades < 6)
Read grade1
Read grade2
Read grade3
Read grade4
Read grade5
Set numberOfGrade to 6
Write “Your name is “, name, ” and your grades are “, grade1, grade2, grade3, grade4, grade5