Algorithms · Algorithm Analysis and Asymptotic Notation
Design and Analysis of Algorithms
Overview
Design and Analysis of Algorithms is the stage of problem solving that comes before implementing any algorithm as a program.
For a given problem there may be many candidate algorithms; the task is to design them and then analyze each one on two resources: time and memory.
The goal is to pick the algorithm that is good in terms of both time and memory, and only then implement it as a program (in C).
Key concepts
- Design and Analysis of Algorithms: the stage of problem solving that comes before implementing any algorithm as a program.
For a given problem there may be many candidate algorithms; the task is to design them and then analyze each one on two resources. - Time: which algorithm executes faster (less time).
- Memory: which algorithm requires less memory.
- Goal of analysis: pick the algorithm that is good in terms of both time and memory, i.e. the one taking the least time and the least memory, and only then implement it as a program (in C).
- Why analysis precedes implementation: before writing any algorithm as a program, we must know which among the available algorithms is good in terms of time and memory, so that effort is not spent implementing a poor algorithm.
How it works
- Design — for a given problem, identify how many algorithms exist / can be designed to solve it.
- Analyze — for each designed algorithm, determine the time taken by that algorithm and the memory required by that algorithm.
- Compare — compare all candidates on these two measures.
- Select the best — choose the algorithm that takes the least time and the least memory.
- Implement — only after design, analysis and selection, implement the chosen algorithm as a program in C.
Comparison
| Criterion | Question it answers |
|---|---|
| Time | Which algorithm executes faster (less time)? |
| Memory | Which algorithm requires less memory? |
Revision summary
- Two criteria of algorithm quality: time (speed of execution) and memory (space required).
- Order of work: design → analyze → pick the best (least time, least memory) → implement (in C).
- Analysis is done before implementation, not after.
- The purpose of Design and Analysis of Algorithms is to decide, among several algorithms for the same problem, which one is best in time and memory.
- Implementation is in C, and only after design, analysis and selection.
Previous-year exam insights
- Time complexity of an algorithm is measured by counting the number of key (basic) operations it performs as a function of input size, not by counting microseconds or kilobytes.
Asked inUGC NET 2015 - If an algorithm consists of two modules executed sequentially with complexities h(n) and g(n), the overall time complexity is h(n) + g(n), i.e. Θ(max(h(n), g(n))); if they are nested, it is h(n) × g(n).
Asked inUGC NET 2014 - Asymptotic notations: O gives an upper bound, Ω a lower bound, Θ a tight bound; worst-case, best-case and average-case analyses may differ, and the fastest algorithm for a problem is bounded below by the problem's lower bound.
Asked inGATE 2026 - Space complexity = fixed (constant) part + variable part (input-dependent auxiliary space);
auxiliary space excludes the input itself, and time–space trade-off means improving one may worsen the other. - A single pass over an array of size n takes time, so conditions over all pairs of adjacent differences can often be checked in rather than Θ(n²) by computing all differences once and scanning them.
Asked inGATE 2026 - For a dynamic-programming table with n×n entries each computed in from previously filled entries, the time complexity is Θ(n²) and the space complexity is Θ(n²) (or less with rolling arrays).
Asked inGATE 2026