Tuesday, 16 October 2012

Computer Algorithims


“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
 An algorithim is a step by step instruction manual, that is in a prescribed sequence to achieve a goal. It is especially used for a mathematical rule or to procedure a desired result in computing. Algorithms are the basis for most computer programming.

2.       Pseudocode
 'Pseudo' means like something, its not something, but its another name for it. Pseudocode is like a code. It is not real code, but it is a tool used by programmers to desrcibe an algorithim. It contains standard words like begin, end, hint, but it is not code and not understood by a computer.

3.       Machine Language
 Machine language is a code for an algorithim, written in a low level language that only the computer is able to understand. i.e. doesn't have English words in it.

4.       High Level Computer Language
 High level computing language contains regular words like if, then, else.etc.

5.       Flowchart
 A flowchart is another way to describe an algorthrim, but it is diagram. It uses a standard symbols. e.g a diamond symbol is used for selection.

6.       Sequence
 Sequence is the order in which the steps in an algorithim are carried out.

7.       Selection
 Selection is where in an algorithim is where you have to make a choice, usually between two items/things. e.g. is the light green? YES or NO. Computers are nothing more than just switches.

8.       Repetition
 Repeating a step over and over again until your goal is achieved or a condition is met.

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.

Turnn left 90 degrees
Walk 5 steps straight
Turn 90 degrees left
Walk two steps forward
Grab the hand with your right arm
Turn the handle clockwise
Pull the door towards you

2.       Negotiating traffic lights as you drive down a street.

Is the light green?
If Yes, continue driving, if  No go to next question
Is the light yellow?
If Yes, slow down, if No go to next question
Is the light red?
If Yes, stop


 

No comments:

Post a Comment