Algorithm:
- It is a finite step-by-step procedure to achieve a required result.
- It is a sequence of computational steps that transform the input into the output.
- It is a sequence of operations performed on data that have to be organized in data structures.
- It is an abstraction of a program to be executed on a physical machine.
Analysis of Algorithms: Analysis of algorithms is the study of computer program performance and resource usage. Following things are considered to be very important to design the algorithm.
- Modularity of the program
- User-friendliness
- Correctness of the program
- Programmer’s time
- Maintainability
- Security
- Functionality
- Robustness
- Simplicity
- Extensibility
- Reliability
- Scalability
Algorithm can be designed for the many problems:
- Sorting n numbers
- Searching an element
- Finding maximum and minimum element from the given list
- Sum of n numbers
- Single source shortest path
- Minimum spanning tree
- Travelling Sales Person problem
- All pairs shortest path, etc.
Strategy of Algorithms:
- Greedy Algorithms
- Divide & conquer Algorithms
- Prune & search Algorithms
- Dynamic programming
- Branch and bound Technique
- Approximation Algorithms
- Heuristics
Example-1: Maximum of the given array of elements Maximum(A, n) {
Max = A[0];
for (i = 1 to n −1)
{ if Max < A[i] then Max = A[i]; }
return Max; }