Transcript for:
Understanding Algorithm Performance Analysis

Now let's see about performance analysis of an algorithm. We can analyze the performance of an algorithm by using two ways. First one is time complexity, second one is space complexity.

So in order to analyze the performance of an algorithm, we use time complexity as well as space complexity. space complexity so first let's see about time complexity first let's see the definition of time complexity the amount of time that an algorithm requires for its execution is known as time complexity so how much time that an algorithm requires for its execution is nothing but time complexity there are mainly three types of time complexities are available the first one is best case time complexity first one is best case time complexity second one is forest case time complexity what is the case time complexity third one is yaga race case time complexity so we have three types of time complexities best case worst case average case now let's see about best case and complexity if an algorithm requires minimum amount of time if an algorithm requires minimum amount of time for its execution then it is known as best case and complex so best case means algorithm requires minimum amount of for its execution. Now let's see what is worst case time complexity.

If an algorithm requires maximum amount of time, if an algorithm requires maximum amount of time for its execution, then it is known as worst case time complexity. Now let's see what is average case time complexity. If an algorithm requires average amount of time, If an algorithm requires average amount of time for its execution, then it is called as worst case time complaint. Now let's see an example for best case, worst case and average case.

Before that, let's see what is linear search. So linear search means searching the elements of the list one by one until the key element is found or the array is completely exhausted. the array is completed let the elements of the list are some 10 20 30 40 50 various the key element is 40. so first we have to compare 10 with 40 so not equal so compare 20 with 40 not equal so compare 30 with 40 not equal next to compare 40 with 40 equal so we can say that the key element is found so these are nothing but elements of the array or elements of the list so this is nothing but key element so compare key element with elements of the array one by one until the key element is found or the array is exhausted the array is completed so let the element let the key element here is 100 so 10 100 not equal 20 100 not equal 30 100 not equal 40 100 not equal 50 100 not equal array is exhausted array is completed so we can say that here the key element is not wrong so while searching an element using linear set if the key element found at first position that the key element is 10 so compare 10 with 10 both are equal so this is nothing but best case so while searching an element using linear set if the key element found at first position then it is called as best case time complexity why because what is best case time complexity Algorithm requires minimum amount of time for its execution. So here we need only one unit of time for comparing the element. Now let's see an example for Verstigia's time complexity.

While searching an element using linear search, if the key element requires maximum amount of time, that means if the key element found at last position while searching an element using linear search, If the key element found at last position, then it is called as worst case time complexity. why because varsity case means algorithm requires maximum amount of time for its execution so here what is the maximum amount of time five units of time so 10 50 not equal 20 50 not equal 30 50 not equal 40 50 not equal 50 50 so they are equal so you can say that this is the best example for varsity case so what is the best example for best case if the key element found at first position then it is best case what is worst case if the key element found at last position then it is worst case next the average case means if the key element found at some second place or third place or fourth place then we can say that it is some average case time complexity okay so this is about different types of time complexities so best case what is best case time complexity while searching an element using linear search if the key element found at first position then it is best case if the key element found at last position then it is worst case if the key element found at some middle position it may be some second position or third position or fourth position then it is nothing but average case time complex so best case means algorithm requires minimum time for its execution worst case means algorithm requires maximum time for its execution average case means algorithm requires math average amount of time for its execution in order to calculate time complexity we have two approaches the first approach is frequency count or step counter so there are two approaches in order to calculate time complexity the first one is frequency count or step count whereas the second approach is asymptotic notations The second approach is asymptotic notations. So we can calculate time complexity using two approaches.

First one, frequency count or step count. Second one, asymptotic notations. We will discuss about frequency count and asymptotic notations in the next videos.

Now let us see what is space complexity? What is time complexity? The amount of time that an algorithm requires for its execution.

So, various space complexity means in place of time we need to write space. So, the amount of space that an algorithm requires for its execution is known as space complexity. We will discuss how to calculate space complexity in frequency count or step count approaches.

So, this is about performance of performance analysis of an algorithm. So, we can analyze performance of an algorithm using time complexity as well as space complexity again we can calculate time complexity using two approaches frequency counter step count and asymptotic notations so we'll discuss about frequency count and asymptotic notations in the next videos okay