Best Case,Worst Case and Average Case Analysis of
Algorithm
• Best Case, Worst Case and Average Case Analysis of an Algorithm
• To define an algorithm, To define the events in the life of an algorithm ,
We have , Best Case Worst Case and Expected Case. And along with that,
I ‘ve packed one more thing into this notes: The definition of Log. If you
read this notes till the end , Then you will find out what this ‘Log ‘ really
is. 1. . . 5. . . 7. . . 9 and 24 are the numbers in it; They ‘re in ascending
order , You can see for yourself. If you know even a bit of maths, You ‘ll
know that it is in an ascending order. Now what I say is that I ‘ll give a
number : ‘A’ And I ‘d like you to tell me If this number exists within the
array , or not. Suppose the value of A is 8. So what will be your answer ?
Yes. Meaning 1. If A is. . . Sorry, your answer will be no , because it isn’t
there. If the value is 9, What will the answer be ? Your answer will Algo 1
is a simple person. It doesn't have much of a brain. It is comparing it with
all the numbers. Is this the best way to do this work ? Obviously not.
Because Algo. 1 is lucky , He will get A=1. It will tell us in the first
comparison itself. In one comparison only.
Algorithm
• Best Case, Worst Case and Average Case Analysis of an Algorithm
• To define an algorithm, To define the events in the life of an algorithm ,
We have , Best Case Worst Case and Expected Case. And along with that,
I ‘ve packed one more thing into this notes: The definition of Log. If you
read this notes till the end , Then you will find out what this ‘Log ‘ really
is. 1. . . 5. . . 7. . . 9 and 24 are the numbers in it; They ‘re in ascending
order , You can see for yourself. If you know even a bit of maths, You ‘ll
know that it is in an ascending order. Now what I say is that I ‘ll give a
number : ‘A’ And I ‘d like you to tell me If this number exists within the
array , or not. Suppose the value of A is 8. So what will be your answer ?
Yes. Meaning 1. If A is. . . Sorry, your answer will be no , because it isn’t
there. If the value is 9, What will the answer be ? Your answer will Algo 1
is a simple person. It doesn't have much of a brain. It is comparing it with
all the numbers. Is this the best way to do this work ? Obviously not.
Because Algo. 1 is lucky , He will get A=1. It will tell us in the first
comparison itself. In one comparison only.