Tuesday, October 12, 2010

Computer Algorithms

Definitions:
1. Algorithms:
A step by step problem solving procedure, also an established recursive computiational procedure for solving a problem in a finite number of steps.
2. Pseudocode:
The steps we would take to solve a problem.
3. Machine Language:
It is a system of instructions and data effected directly by a computer's central processing unit.
4. High Level Computer Language:
A programming language with strong abstraction from the details of the computer. It can be read by multiple computers and operating systems.
5. Flowchart:
It is a type of diagram that represents an algorithm or process, showing the steps as boces of various kinds and their order is connected by using arrows. It is helpful to solve programming problems if it is put in a flowchart.
All of these relate to the control structure of a program.
6. Sequence:
Where you do the items in the sequence listed.
7. Selection:
A control function that allows us to have multiple options.
8. Repetition:
That allows some lines of code to be executed many times.
Opening a door and entering a room:
  1. Turn the door knob and walk in.
  2. If door knob doesnt open easily try to push or pull harder maybe the door is jammed.
  3. If it still doesnt open check if the door is locked.
  4. Look for a key to open the door.
  5. After turning the key if the door still doesnt open maybe the door knob is broken then call locksmith for help.
Negotiating traffic lights as you drive down a street:
  1. If the light is green just drive pass it.
  2. If it just turned amber, drive pass it.
  3. If it has been amber for a long time slow down or stop because it may turn red.
  4. If the light is red then stop and wait for it to turn green.

No comments:

Post a Comment