- Related Questions & Answers
- Amortized Complexity
- Asymptotic Notation - O(), o(), Ω(), ω(), and θ()
- C++ Program to Find Second Smallest of n Elements with Given Complexity Constraint
- C++ Program to Implement Sorting of Less than 100 Numbers in O(n) Complexity
- C++ Program to Implement Quick Sort with Given Complexity Constraint
- What is 'Space Complexity’?
- Asymptotic Notations
- Asymptotic Analysis
- Complexity of an algorithm for size n=3
- How to calculate the time complexity of interpolation search?

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Using asymptotic analysis, we can get an idea about the performance of the algorithm based on the input size. We should not calculate the exact running time, but we should find the relation between the running time and the input size. We should follow the running time when the size of input is increased.

For the space complexity, our goal is to get the relation or function that how much space in the main memory is occupied to complete the algorithm.

For a function **f(n)** the asymptotic behavior is the growth of f(n) as n gets large. Small input values are not considered. Our task is to find how much time it will take for large value of the input.

For example, f(n) = c * n + k as linear time complexity. f(n) = c * n^{2} + k is quadratic time complexity.

The analysis of algorithms can be divided into three different cases. The cases are as follows −

**Best Case** − Here the lower bound of running time is calculated. It describes the behavior of algorithm under optimal conditions.

**Average Case** − In this case we calculate the region between upper and lower bound of the running time of algorithms. In this case the number of executed operations are not minimum and not maximum.

**Worst Case** − In this case we calculate the upper bound of the running time of algorithms. In this case maximum number of operations are executed.

Advertisements