Wednesday, October 20, 2010

Step two - Computer Algorithms


DEFINITIONS
1. Algorithms
In its most general sense, an algorithm is any set of detailed instructions which results in a predictable end-state from a known beginning. Algorithms are only as good as the instructions given, however, and the result will be incorrect if the algorithm is not properly defined.

2. Pseudocode
Pseudocode is a compact and informal high-level description of a computer programming algorithm that uses the structural conventions of a programming language, but is intended for human reading rather than machine reading.

3. Machine Language
Machine code or machine language is a system of instructions and data executed directly by a computer's central processing unit.

4. High Level Computer Language
A high-level programming language is a programming language with strong abstraction from the details of the computer. In comparison to low-level programming languages, it may use natural language elements, be easier to use, or be more portable across platforms. Such languages hide the details of CPU operations such as memory access models and management of scope.

5. Flowchart
A flowchart is a type of diagram, that represents an algorithmm or process, showing the steps as boxes of various kinds, and their order by connecting these with arrows. This diagrammatic representation can give a step-by-step solution to a given problem. Data is represented in these boxes, and arrows connecting them represent flow / direction of flow of data.

6. Sequence
In mathematics, a sequence is an ordered list of objects (or events). Like a set, it contains members (also called elements or terms), and the number of terms (possibly infinite) is called the length of the sequence. Unlike a set, order matters, and exactly the same elements can appear multiple times at different positions in the sequence. A sequence is a discrete function

7. Selection

The act of choosing or selecting. ('If' or 'Then')
8. Repition
The act or process of repeating a set or sequence of instructions.


ALGORITHMS

a) Opening a Door and Entering a Room
1. Position yourself in front of the door
2. Lift your hand slightly
3. Rest your hand on the door knob
4. Twist in a clockwise direction and pull
5. Release the door knob
6. Walk straight forward through the door
7. Enter the room

 b) Traffic Lights Algorithm
1. Approach lights
2. Check colour of light
3. If the light is green, then continue driving
4. If the light is red, then prepare to stop
5. If the light is orange, then slow down






No comments:

Post a Comment