Tools Used in Problem Solving
Programming As seen earlier, a program is a set of instructions to solve a particular problem. Before we actually start writing a program, we need to derive a procedure to solve the problem. The procedure to solve a problem can be represented by using the following tools: Algorithm, Flowchart, Pseudocode Details Tools Used in Problem Solving As seen earlier, a program is a set of instructions to solve a particular problem. Before we actually start writing a program, we need to derive a procedure to solve the problem. The procedure to solve a problem can be represented by using the following tools: Algorithm, Flowchart, Pseudocode Algorithm An algorithm is a sequence of steps required to solve a problem. It is a list of well-defined instructions to solve a problem. According to D.E. Knuth, a pioneer in the field of computer science, an algorithm has the following characteristics: An algorithm ends after a fixed number of steps. Each step in an algorithm clearly specifies the action to be performed. The steps in an algorithm specify basic operations. These operations could include calculations, input/output operations, and comparisons. An algorithm accepts input data, in a defined format, before it can be processed. An algorithm generates one or more outputs after the input is processed. The resultant information termed as output can be displayed or stored for future reference. For example, to withdraw a required amount from an ATM, the algorithm will be: Step 1: Start the algorithm. Step 2: Go to any local ATM. Step 3: Insert/swipe your ATM card. Step 4: Press the language button that you want to choose. Step 5: Enter the pin code number. Step 6: Press the account type (Savings or Current) button from which you want to withdraw the money. Step 7: Press the cash withdrawal button. Step 8: Enter the amount you want to withdraw. Step 9: Collect the amount from the ATM machine. Step 10: Collect the statement from the ATM machine. Step 11: Collect your ATM card. Step 12: End the algorithm. An algorithm follows the I-P-O cycle to solve a problem. Here, the inputs to withdraw a required amount from an ATM would be the ATM card, the pin code number, and the amount that you want to withdraw. These inputs are then accepted and the process of withdrawing the amount takes place. At the end of the process, the amount, which is the output, is withdrawn. Consider another example where a television company may provide the following algorithm in the television manual to troubleshoot the 'No sound' problem: Step 1: Start the algorithm. Step 2: Ensure that the Mute button is not pressed. Step 3: Ensure that the desired volume is set. Step 4: If sound is still inaudible, call the television engineer. Step 5: End the algorithm. Flowchart A flowchart is a graphical representation of an algorithm. It consists of a set of symbols. Each symbol represents a specific kind of activity depicted in the algorithm. A typical problem would involve accepting input, processing the input, and displaying the output. The processing would involve the computations and the decisions that are being taken. Advantages of Flowchart Flowchart offers many advantages. Some of these advantages are: Flowcharts help in analyzing the problems effectively. Flowcharts act as a guide during the program development phase. Flowcharts help easy debugging of logical errors. Disadvantages of Flowchart Although flowchart provides several advantages, it has a few disadvantages as well. Some of these disadvantages are: A lengthy flowchart may extend over multiple pages, which reduces readability. Drawing a flowchart using any graphical tool is a time consuming process. The changes made to a single step may cause redrawing the entire flowchart. Pseudocode Pseudocode is a detailed yet readable description of what an algorithm must do, expressed in a formally styled natural language rather than in a programming language. Pseudocode is used as an initial step in the process of developing a program. It provides programmers a detailed template for writing instructions in a specific programming language. Advantages of Pseudocode The advantages of using pseudocode are: It is easy and fast to write as it uses English like statements. It needs no rewriting if any changes are made in the steps. This is because each step is written independent of the other. It can be converted to a program by using any programming language. This is because the format used by pseudocode is similar to a program. They both contain a set of sequential statements using a defined set of keywords. Limitations of Pseudocode The limitations of using pseudocode are: Pseudocode does not provide a graphical representation of an algorithm; therefore, it might be difficult to understand the complex logic in a pseudocode. Pseudocode depicting too many nested conditions may be difficult to understand.
Sent from Windows Mail