example of Alogarthm :
The steps call at a pay phone coin :
- Pick up the phone
- Insert coin
- Press the number to call
- talk
- Put the phone down
- Prepare the glass up X
- Pour a cup of tea into a glass containing X
- Pour the cup of coffee to cups of tea
- Pour a glass of X that contains tea to coffee cups
output
An algorithm must have outputs which must be a solution of the problem being solved
Effectiveness and efficiency
Effective = generate an appropriate solution to the problem should be solved in the sense of appropriate algorithms
Efficiency of an algorithm processing = time is shorter and uses less computer memory
Finite number of steps
Rows of instructions that must be made in a certain order or must be finite so that the problems encountered can be solved by not requiring a relatively long time
ends
The process in finding a solution to a problem must be stopped and ended with the end result which is a solution or in the form of information that is not found a solution ≠ SEMI ALGORITHM
structured
Completion of the sequence of steps should be structured in such a way so that the process can run and end up with no kink or repeated. In the process must clear the input, process, and output.
there is quote in alogarithm
"A resolution process which generates the appropriate output (effective) in a relatively short time and using relatively little memory (efficient) with finite steps and the procedure ends either in a state to obtain a solution or no solution"
Basic Structure Algorithm
(sequences)
actions in the algorithm are done sequentially example:
A1. Action 1
A2. Action 2
A3. Action 3
(selection)
action performed if certain conditions are met
example :
IF condition1 THEN
Action 1
ELSE
IF condition2 THEN
Action 2
ELSE
Action 3
(Action 3 performed if conditions 1 and 2 are not met)
(repeatition)
actions done repeatedly
example:
FOR enumerator repetition of a to b DO
Action
(actions carried out as a matter of repetition counter, ie from a to b that as many as b-a + 1 times)
REPEAT
Action
UNTIL condition
(repetition of actions carried out so that the conditions / requirements are met stops)
WHILE condition DO
Action
(as long as the conditions / requirements repetition is true, then the action is done)
writing algorithms
- Description descriptive, using language that is commonly used in everyday life.
- Pseudocode, which agreed codes and has a particular meaning.
- Flow chart (flow charts), which has a graphical notation that setiapnya certain sense.
for more detail about writing algorithms , see you tommorow . time for sleep .
No comments:
Post a Comment