Algorithm_and_Asymptotic_Notations_ADA
Algorithm_and_Asymptotic_Notations_ADA
Definition of Algorithm:
An algorithm is a step-by-step procedure or set of rules designed to perform a specific task or solve
a particular problem.
1. Start
5. Stop
Asymptotic Notations:
Asymptotic notations describe the performance of an algorithm in terms of input size (n) when n
It helps us to understand how the algorithm behaves in terms of time and space complexity.
It describes the maximum time an algorithm can take for any input.
Example: In linear search, in the worst case, we may have to search the entire array.
So, Time Complexity = Big O(n)
It describes the minimum time an algorithm will take for the best input.
It gives a tight bound, showing both the upper and lower limit for the time taken.
Example: On average, in linear search, the element may be found in the middle.
Let's take an array of size n and apply Linear Search to find an element.
- Worst Case (O): Element is at last or not present -> Big O(n)
Conclusion:
Asymptotic notations help in analyzing and comparing algorithms without running them.
They give us an idea of efficiency when the input size becomes very large.