Writing Rules Algorithm
The algorithm contains a step-by-step problem-solving. These steps can be
written in any notation, provided easy to read and understand, because it is not
no standard notation in writing the algorithm. Each person can make writing rules
and notation algorithm itself. Notation so that the algorithm easily translated into the notation
programming language, the notation should berkorespnden algorithm with
programming language notation in general.
Writing Rules Algorithm
Each algorithm will always consist of three parts namely:
• Title (Header)
• Dictionary
• Algorithm
In each of these sections will be written if the comments about each section
is written between parentheses Kaurawas example (Comments). Notation algoritmis
written between these marks will not be executed by the program.
Example:
Title (Header)
The title is the text of the algorithm is used for defining the name
to determine whether the text is a program, procedures, functions. After title
advised to write a brief specification of the algorithm text. Name
algorithm should be brief but fairly describes what will be done by
algorithm.
Example:
Note:
To separate between words in the title of the algorithm uses the sign "_" is not
a must. You can write LuasLingkaran or Luas_Lingkaran. But
You should not use the space "" to separate between words in the name of
algorithm.
Title
(Comments on algorithms such as the workings of the program, initial condition and the condition
the end of the algorithm)
Dictionary
(In this section, didefinifikan a constant, variable names, procedure names and
name of the function)
Algorithms
(In this section written algorithm. All written text is not among the signs
brackets Kaurawas notation will be considered as an algorithm that will affect
the truth algorithm)
Program Title Luas_Kubus ← (algorithm)
(Calculate the area to the size of the cube that is read from the input devices and
print results kepiranti output) ← (Specification Algorithm)
3
Dictionary (Declaration)
Dictionary algorithm is part of the text as a place to define:
• Name type
• Name of constant
• Variable Name
• Name the function
• Name of procedure
All the new name can be used in the algorithm if it has been defined prior
first in the dictionary. Writing a set of names in the dictionary should be grouped
according to the type name.
Undefined variable name value as defined. Definition name
constants as well as providing constant prices, the definition of a function
performed well with the domain / range and specifications. Definition name
procedures as well as the defining parameters (if any) and specification procedures
(initial conditions "Initial State", Condition end "Final State" and the process is done).
Example:
Dictionary
(Name type, only type that is not the basic type)
type hours: (Type-hour consists of 3 input is "hh" as
watch. "Mm" for minutes and "ss" for seconds)
(Name constants, must indicate the type and value)
constant phi: real = 3.14159
constant name: string = 'Alex'
constant true: boolean = true
(Name Information, mentioned type)
x, y: integer (a value) bertype integers
NMax: real (bertype maximum value of real numbers)
Name: string (a value which is a collection of character)
P: point (a value in the field kartesian)
Search for: Boolean logic values (a)
4
Algorithm (Description)
Algorithm is the core of an algorithm which contains the instructions or call
actions that have been defined. Text component algorithm in procedural programming
can be:
• basic instructions such as input / output, assignment
• Sequence (sequence)
• Analysis of cases
• Repetition
Every step algorithm is read from the "top" to "down". The order of description writing
menentuan command execution sequence.
Example:
Algorithms
input (c, d) (accept input 2 numbers c and d)
if c
e ← a + b (e in the assignment of the value of a and b)
else
e ← a - b
output (e) (result output numbers of e)
(Name of function, domain name and range)
RealToInt function (x: real) → integer
(change the price of x bertype real becomes equivalent to the price of bertype integer)
(Name of the procedure, refer to "IS" initial state, "FS" and the final state)
procedure exchange (input / output x, y: real)
(IS-defining x and y, x = a and y = b
FS x = b and y = a
Process: swap the contents of the information numbers x and y)
5
Note:
For the words of inputs, outputs, if then else, output will be studied more deeply in
subsequent chapters.
Examples of Solving Problems By Algorithm
Print a String "Good Learning Algorithms and Programming" to the output device.
Determining the largest value of the integer read from input devices and
write the result to the output device.
Cetak_string Program
(print the string "Good Learning Algorithms and Programming" to the device
output)
Dictionary
(not)
Algorithms
Output ( 'Good Learning Algorithms and Programming')
Nilai_Maksimal Program
(Determine the highest value is read from the input devices and the results are printed
to the output device)
Dictionary
results, x, y: integer (result is a variable to hold the output value)
(x, y is the variable to hold the input value)
Algorithms
input (x, y) (read a value of x and y of input devices)
if x
result ← x (results on assignment by the largest indigo)
else
result ← y
output (result) (values printed in the result variable to the output device
The algorithm contains a step-by-step problem-solving. These steps can be
written in any notation, provided easy to read and understand, because it is not
no standard notation in writing the algorithm. Each person can make writing rules
and notation algorithm itself. Notation so that the algorithm easily translated into the notation
programming language, the notation should berkorespnden algorithm with
programming language notation in general.
Writing Rules Algorithm
Each algorithm will always consist of three parts namely:
• Title (Header)
• Dictionary
• Algorithm
In each of these sections will be written if the comments about each section
is written between parentheses Kaurawas example (Comments). Notation algoritmis
written between these marks will not be executed by the program.
Example:
Title (Header)
The title is the text of the algorithm is used for defining the name
to determine whether the text is a program, procedures, functions. After title
advised to write a brief specification of the algorithm text. Name
algorithm should be brief but fairly describes what will be done by
algorithm.
Example:
Note:
To separate between words in the title of the algorithm uses the sign "_" is not
a must. You can write LuasLingkaran or Luas_Lingkaran. But
You should not use the space "" to separate between words in the name of
algorithm.
Title
(Comments on algorithms such as the workings of the program, initial condition and the condition
the end of the algorithm)
Dictionary
(In this section, didefinifikan a constant, variable names, procedure names and
name of the function)
Algorithms
(In this section written algorithm. All written text is not among the signs
brackets Kaurawas notation will be considered as an algorithm that will affect
the truth algorithm)
Program Title Luas_Kubus ← (algorithm)
(Calculate the area to the size of the cube that is read from the input devices and
print results kepiranti output) ← (Specification Algorithm)
3
Dictionary (Declaration)
Dictionary algorithm is part of the text as a place to define:
• Name type
• Name of constant
• Variable Name
• Name the function
• Name of procedure
All the new name can be used in the algorithm if it has been defined prior
first in the dictionary. Writing a set of names in the dictionary should be grouped
according to the type name.
Undefined variable name value as defined. Definition name
constants as well as providing constant prices, the definition of a function
performed well with the domain / range and specifications. Definition name
procedures as well as the defining parameters (if any) and specification procedures
(initial conditions "Initial State", Condition end "Final State" and the process is done).
Example:
Dictionary
(Name type, only type that is not the basic type)
type hours:
watch. "Mm" for minutes and "ss" for seconds)
(Name constants, must indicate the type and value)
constant phi: real = 3.14159
constant name: string = 'Alex'
constant true: boolean = true
(Name Information, mentioned type)
x, y: integer (a value) bertype integers
NMax: real (bertype maximum value of real numbers)
Name: string (a value which is a collection of character)
P: point (a value in the field kartesian)
Search for: Boolean logic values (a)
4
Algorithm (Description)
Algorithm is the core of an algorithm which contains the instructions or call
actions that have been defined. Text component algorithm in procedural programming
can be:
• basic instructions such as input / output, assignment
• Sequence (sequence)
• Analysis of cases
• Repetition
Every step algorithm is read from the "top" to "down". The order of description writing
menentuan command execution sequence.
Example:
Algorithms
input (c, d) (accept input 2 numbers c and d)
if c
e ← a + b (e in the assignment of the value of a and b)
else
e ← a - b
output (e) (result output numbers of e)
(Name of function, domain name and range)
RealToInt function (x: real) → integer
(change the price of x bertype real becomes equivalent to the price of bertype integer)
(Name of the procedure, refer to "IS" initial state, "FS" and the final state)
procedure exchange (input / output x, y: real)
(IS-defining x and y, x = a and y = b
FS x = b and y = a
Process: swap the contents of the information numbers x and y)
5
Note:
For the words of inputs, outputs, if then else, output will be studied more deeply in
subsequent chapters.
Examples of Solving Problems By Algorithm
Print a String "Good Learning Algorithms and Programming" to the output device.
Determining the largest value of the integer read from input devices and
write the result to the output device.
Cetak_string Program
(print the string "Good Learning Algorithms and Programming" to the device
output)
Dictionary
(not)
Algorithms
Output ( 'Good Learning Algorithms and Programming')
Nilai_Maksimal Program
(Determine the highest value is read from the input devices and the results are printed
to the output device)
Dictionary
results, x, y: integer (result is a variable to hold the output value)
(x, y is the variable to hold the input value)
Algorithms
input (x, y) (read a value of x and y of input devices)
if x
result ← x (results on assignment by the largest indigo)
else
result ← y
output (result) (values printed in the result variable to the output device
1 Komentar untuk "ALGORITHM ADVENCED"
you have a nice site. thanks for sharing this site. you can download lots of ebook from here
http://feboook.blogspot.com