3. WHAT IS ALGORITHM ?
• An algorithm is a sequence of
unambiguous instructions for solving a problem,
i.e., for obtaining a required output for any
legitimate input in a finite amount of time.
• An algorithm is a step-by-step procedure to solve a
given problem.
4. CHARACTERISTICS OF
ALGORITHMS
• Finiteness: Algorithms terminate after a finite number of steps.
• Definiteness: Each steps of an algorithm must be precisely defined.
• Inputs: An algorithm has zero or more but only finite, number of
inputs
• Outputs: An algorithm should have 1 or more well-defined outputs,
and should match the desired output.
• Effectiveness : An algorithm should be effective.
5. PHASES OF ALGORITHMS
There are four phases of algorithm:
• Design of Algorithms
• Algorithm Validation
• Analysis of Algorithms
• Algorithm Testing
6. DESIGN OF ALGORITHMS
• It is used to find the a correct solution for a problem.
• Designing techniques are:
Divide and Conquer algorithm
Binary Search, Merge Sort, Heap sort, Strassen’s Algorithm, FFT
algorithms etc.
Incremental approach
Insertion sort
Dynamic programming
MCM, LCS, 0-1 Knapsack Problem, Shortest path (Floyd Warshall
Algorithm, Bellman Ford Algorithm) etc.
Greedy algorithm
Minimum Spanning Tree, Dijkstra's Shortest Path Algorithm,
Activity Selection Problem, Huffman Coding, Fractional
Knapsack problem etc.
7. ALGORITHM VALIDATION
It involves checking the logic, the inputs, the outputs, and
the behavior of the algorithm under different scenarios and
conditions.
Validating an algorithm confirms that it is actually
providing a mathematical solution to the problem we are
trying to solve.
This phase is also known as program proving or program
verification.
8. ANALYSIS OF ALGORITHM
It is used to determine the amount of computing time and
storage space of an algorithm.
It focuses on
Time complexity
Space complexity
Time complexity: Amount of time required an
algorithm or program to run to completion.
Space complexity : Amount of memory required
program to run to completion.
9. ALGORITHM TESTING
• It tests the program.
• It consists of two phases:
Debugging
Performance measurement
Debugging:
Debugging is the process of finding and
correcting the cause.
Performance measurement:
The performance measurement or profiling
precisely describe the correct program execution for all
possible data sets.