Skip to content

Commit

Permalink
Images of each asymptotic notations are added (freeCodeCamp#28112)
Browse files Browse the repository at this point in the history
For understanding the algorithm complexity better, images of each asymptotic notations are added
  • Loading branch information
AlfredSkaria authored and cmccormack committed Jan 21, 2019
1 parent b0f4d2c commit 95702d6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions guide/english/algorithms/algorithm-performance/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,25 @@ The following 3 notations are mostly used to represent time complexity of algori

1. **Θ Notation**: The theta notation bounds a functions from above and below, so it defines exact behavior. we can say that we have theta notation when worst case and best case are the same.
>Θ(g(n)) = {f(n): there exist positive constants c1, c2 and n0 such that 0 <= c1*g(n) <= f(n) <= c2*g(n) for all n >= n0}
<img src = "https://cdncontribute.geeksforgeeks.org/wp-content/uploads/AlgoAnalysis-1.png" />

2. **Big O Notation**: The Big O notation defines an upper bound of an algorithm. For example Insertion Sort takes linear time in best case and quadratic time in worst case. We can safely say that the time complexity of Insertion sort is *O*(*n^2*).
>O(g(n)) = { f(n): there exist positive constants c and n0 such that 0 <= f(n) <= cg(n) for all n >= n0}
<img src = "https://cdncontribute.geeksforgeeks.org/wp-content/uploads/AlgoAnalysis-2.png"/>

3. **Ω Notation**: Ω notation provides an lower bound to algorithm. it shows fastest possible answer for that algorithm.
>Ω (g(n)) = {f(n): there exist positive constants c and n0 such that 0 <= cg(n) <= f(n) for all n >= n0}.
<img src = "https://cdncontribute.geeksforgeeks.org/wp-content/uploads/AlgoAnalysis-3.png"/>

4. **Little o Notation**: The little o notation defines a strict upper bound of an algorithm. This means that f(n) is less than c * g(n) for all c, but cannot be equal.

5. **ω Notation**: ω (Little Ω) notation provides a strict lower bound to algorithm. This means that f(n) is greater than c * g(n) for all c, but cannot be equal.

*images are from geeksforgeeks

## Examples

As an example, we can examine the time complexity of the <a href='https://github.com/FreeCodeCamp/wiki/blob/master/Algorithms-Bubble-Sort.md#algorithm-bubble-sort' target='_blank' rel='nofollow'>[bubble sort]</a> algorithm and express it using big-O notation.
Expand Down

0 comments on commit 95702d6

Please sign in to comment.