You are on page 1of 12

Assignment : 01

Algorithms

Luong Hoang Hai


BTEC-D02K12
Outline

1 Algorithms
2 WORKING WITH ALGORITHMS IN
THE PROGRAM
Algorithms

 AN ALGORITHM IS A FINITE SET OF WELL-DEFINED INSTRUCTIONS THAT CAN BE


PERFORMED WITH A COMPUTER, OFTEN TO SOLVE A CLASS OF PROBLEMS OR
TO PERFORM A CALCULATION. ALGORITHMS ARE ALWAYS CLEAR AND USED TO
SPECIFY THE EXECUTION OF CALCULATIONS, DATA PROCESSING, AUTOMATED
INFERENCE, AND OTHER OPERATIONS
PROPERTIES OF THE ALGORITHM
Algorithm properties:
- input: the set of value(s) for the
algorithm
- out put: Value(s) that form the solution
to the problem
-Correctness: an algorithm should produce
the correct input for a given set of input
values
finiteness: an algorithm produce an output
after a finite number of steps
Effectiveness and generality: The
algorithm should be applicable for all
possible input values.
EXPRESSION OF THE ALGORITHM

 We can express an algorithm many ways, including natural language, flow charts,
pseudocode, and of course, actual programming languages.
 Natural language is a popular choice, since it comes so naturally to us and can convey
the steps of an algorithm to a wide audience. When we're developing algorithms, we
are often working both with people who know programming and those who don't—but
they all know natural language.
EXPRESSION OF THE ALGORITHM

Flow char:
A more formal way to express an
algorithm is with a flow chart, a
diagram with boxes connected by
arrows.
EXPRESSION OF THE ALGORITHM

Pseudocode:
Ultimately, most algorithms
become code that actually runs
on a computer. Before that
happens, programmers often like
to express an algorithm
in pseudocode: code that uses
all the constructs of a
programming language, but
doesn't actually run anywhere.
EXPRESSION OF THE ALGORITHM

Programming languages:
Once we've planned our algorithm,
whether in natural language, flow
charts, pseudocode, or a
combination, it's time to turn it into
running code.
Some basic algorithms

 1 search algorithms
Some basic algorithms

 1 search algorithms
Coding search algorithms
Some basic algorithms

 2 sort algorithms
Flow char:
Some basic algorithms

 2 sort algorithms
Coding sort algorithms:

You might also like