Wednesday, October 8, 2014

Basic Concepts

Alogarthm is sequence of logical steps for solve a problem compiled systematically . And Programming is a set of instructions / commands to the computer language that serves to connect the user to the computer. Or it could be called the implementation of programming languages .

example of Alogarthm :

The steps call at a pay phone coin :


  1. Pick up the phone 
  2. Insert coin 
  3. Press the number to call  
  4. talk  
  5. Put the phone down
There are 2 pieces of glass. One containing tea and one of coffee. How do I swap the contents of each glass?

   

  1. Prepare the glass up X  
  2. Pour a cup of tea into a glass containing X  
  3. Pour the cup of coffee to cups of tea  
  4. Pour a glass of X that contains tea to coffee cups
 Criteria for the selection algorithm
 

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

  1. Description descriptive, using language that is commonly used in everyday life. 
  2. Pseudocode, which agreed codes and has a particular meaning.  
  3. 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