A problem is a discrepancy between what is
• A problem is a discrepancy between what is required and what exists.
One Two Three
• An algorithm is a sequence of instructions which, if followed in order, produces a solution to a given problem.
• This a thought process that requires a critical analysis of the situation (the problem) and careful consideration of possible ways of overcoming the problem.
Pseudo code is an algorithm that models or resembles the real programming language of the computer. It cannot be executed by the computer.
1. 2. 3. 4. Define the problem Propose and evaluate solutions Determine the most efficient solution. Represent the most efficient solution in the form of an algorithm 5. Test and debug the program 6. Document the program (i. e. a written explanation of how the program works and how to use it)
In order to write a program to accomplish a certain task you must analyse the task as a sequence of instructions that can be performed by the computer. These instructions can be divided into three main parts: Input and Storage instructions, Processing instructions and Output instructions.
Input Processing Output a b If (a<b) then Smallest=a Else Smallest-b smallest
start If(a<b) Smallest=a Smallest=b Print smallest end
input Output a=2 b=6 2 a=17 b=5 5 A=9 b=1 1
- Slides: 15