Professional Documents
Culture Documents
23-Sep-19
Agenda…
1
How to Write Algorithms
• There are the building blocks of an algorithm.
- Sequence
23-Sep-19
- Decision
- Repetition
23-Sep-19
specified set of objects.
Output:
An algorithm has one or more outputs, which have a
23-Sep-19
ALGORITHM double(n)
// The purpose of this algorithm is to double a positive integer
5
Properties of Algorithm…
Determine which characteristics of algorithms is
missing in the following…
23-Sep-19
ALGORITHM double(n)
// The purpose of this algorithm is to double a positive integer
23-Sep-19
ALGORITHM sum(n)
// The purpose of this algorithm is to find the sum of n integer.
7
Properties of Algorithm…
Determine which characteristics of algorithms is
missing in the following…
23-Sep-19
ALGORITHM sum(n)
// The purpose of this algorithm is to find the sum of n integer.
23-Sep-19
ALGORITHM sum(n)
// The purpose of this algorithm is to find the sum of n integer.
9
Properties of Algorithm…
Determine which characteristics of algorithms is
missing in the following…
23-Sep-19
ALGORITHM divide(a,b)
// The purpose of this algorithm is to divide the first value by the
10
Properties of Algorithm…
Determine which characteristics of algorithms is
missing in the following…
23-Sep-19
ALGORITHM divide(a,b)
// The purpose of this algorithm is to divide the first value by the
11
Properties of Algorithm…
Determine which characteristics of algorithms is
missing in the following…
23-Sep-19
ALGORITHM largest(a,b)
// The purpose of this algorithm is to return the largest value
12
Properties of Algorithm…
Determine which characteristics of algorithms is
missing in the following…
23-Sep-19
ALGORITHM largest(a,b)
// The purpose of this algorithm is to return the largest value
23-Sep-19
ALGORITHM largest(a,b)
// The purpose of this algorithm is to return the largest value
14
Properties of Algorithm…
Determine which characteristics of algorithms is
missing in the following…
23-Sep-19
ALGORITHM largest(a,b)
// The purpose of this algorithm is to return the largest value
15
Test
Is the following a legitimate algorithm…
ALGORITHM test
23-Sep-19
// The purpose of this algorithm is to display integer values from
1 to 10
16
Test
Is the following a legitimate algorithm…
ALGORITHM test
23-Sep-19
// The purpose of this algorithm is to display integer values from
1 to 10
17