Pages

Translate

Wednesday, 6 June 2012

Logic Building: Tools Used For Problem Solving (Algorithm)

We already know what programs and programming languages are from my last post. Now we'll talk about problem solving. The procedures to solve a problem can be represented by using any of these:

  • Algorithm
  • Flowchart
  • Pseudocode
ALGORITHM: When we hear algorithm,numbers and calculations are the first things that come to mind right?. It's quite the opposite,an algorithm is a sequence of steps required to solve a problem,it is a list of well defined instructions to solve a given problem.Here's an example of an algorithm that displays the subtraction of two numbers:


STEP 1: Start the algorithm
STEP 2: Get the first number
STEP 3: Get the second number
STEP 4: Subtract the two numbers
STEP 5: Display the result
STEP 6: End the algorithm


Of the three procedures used in problem solving,the algorithm is quite simply the easiest one.The algorithm follows the I-P-O cycle to solve a problem. Here the inputs are the numbers,these inputs are accepted and then the process of subtraction takes place. When the processing is done,the result which is the output is then displayed.
According to D.E Knuth,an algorithm should have 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 algorithm specifies basic operations,these could include calculations,input/output operations and comparisons.
  • An algorithm accepts input data in a defined format before it can be processed.
  • An algorithm can generate one or more outputs after the input is processed. The resulting information termed as output can be displayed or stored for further references.
I will talk about Pseudocode and Flowcharts in my next post.......Until Then........





1 comment:

  1. I so much appriciates these but please I will like to know more thanks.

    ReplyDelete