Professional Documents
Culture Documents
Chapter4 1 2IntroductionToAlgorithm
Chapter4 1 2IntroductionToAlgorithm
4.1 Introduction
4.2 Examples of Algorithms
4.3 Analysis of Algorithms
4.4 Recursive Algorithms
Spring'16 TWHou
4.1 Introduction
An algorithm is a finite set of instructions having the
following characteristics:
Precision.The steps are precisely stated.
Determinism (Uniqueness) The intermediate results of
each step of execution are uniquely defined and depend
only on the inputs and the results of the preceding steps.
Finitness. The algorithm stops after finitely many
instructions have been executed.
Correctness: The output produced by the algorithm is
correct; that is, the algorithm correctly solves the problem.
Input. The algorithm receives input.
Output. The algorithm produces output.
Generality. The algorithm applies to a set of inputs.
Spring'16 TWHou
Trace of an algorithm
pseudocode
Spring'16 TWHou
Spring'16 TWHou
Spring'16 TWHou
Randomized Algorithm
Spring'16 TWHou