Theta Notation Examples
For Complete YouTube Video: Click Here
In this class, we will try to understand Theta Notation.
We have already discussed the concepts of Big O, Omega, and Theta Notations in our previous classes.
Theta Notation Examples
We have discussed in our previous class that theta notation represents the exact bound.
We will consider the example below to understand what the exact bound means.
The above example is an algorithm to find the maximum element in an array.
Let’s consider the array as shown below.
To find the maximum element from the above array, we have to compare all the elements in the array.
How many times we change the input or whatever may be the array size, the for loop will iterate all the n number of times (n means the array size). That means the algorithm will iterate exactly n number of times.
Whenever the algorithm efficiency can be “exactly” determined, those algorithms can be notated with theta notation.
For a better understanding, click the YouTube link provided on the top.