Tuesday, October 12, 2010

Computer Algorithms

“Computers never do what you want them to do,

they only do what you tell them to!”

Using the web, find definitions for the following terms and post them on your blog. Make sure the definitions relate to computers and programming.

1. Algorithms- A set of clear instructions to complete a task in a finite time.
2. Pseudocode- An informal language that helps programmers develop an Algorithm.
3. Machine Language- A system of instructions executed by the computer's CPU.
4. High Level Computer Language- A type of programming laguage that isn't limited by the type of computer or by one specific job.
5. Flowchart- A type of diagram that represents an algorithm process.
6. Sequence- The order in which something is done.
7. Selection- Choose. If and Then.
8. Repetition- Repeating a sequence of instructions.


Then with the aid of class discussions, write an algorithm for the following processes;
In your algorithm write each step of the process on a new line. Remember not to assume the computer knows anything.
1. Opening a door and entering a room-
  • Stand in front of the door,
  • Lift one hand up towards the doorknob,
  • Squeeze the doorknob lightly,
  • Twist it in a clockwise direction,
  • Pull the door towards you,
  • Let go of the doorknob,
  • Walk through the door,
  • Enter the room.

2. Negotiating traffic lights as you drive down a street-
Red Light= Stop, Green Light= Go, Orange Light= Slow down, prepare to stop.
  • Approach the light,
  • Check the colour of the lights,
  • If the light is green then continue driving,
  • If the light is red then prepare to stop driving,
  • If the light is orange then slow down.

No comments:

Post a Comment