answersLogoWhite

0


Best Answer

These are terms given to the various scenarios which can be encountered by an algorithm.

The best case scenario for an algorithm is the arrangement of data for which this algorithm performs best. Take a binary search for example. The best case scenario for this search is that the target value is at the very center of the data you're searching. So the best case time complexity for this would be O(1).

The worst case scenario, on the other hand, describes the absolute worst set of input for a given algorithm. Let's look at a quicksort, which can perform terribly if you always choose the smallest or largest element of a sublist for the pivot value. This will cause quicksort to degenerate to O(n2).

Discounting the best and worst cases, we usually want to look at the average performance of an algorithm. These are the cases for which the algorithm performs "normally."

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between best worst and average case complexity of an algorithm?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the difference between P and NP complexity classes?

P is the class of problems for which there is a deterministic polynomial time algorithm which computes a solution to the problem. NP is the class of problems where there is a nondeterministic algorithm which computes a solution to the problem, but no known deterministic polynomial time solution


What is the difference between AES Rijndael symmetric algorithm encryption and a hash algorithm?

678


What is difference between lemma and algorithm?

A Method that used to be a comouter to soultion of promlems is called algorithm.


What is the difference between an algorithm and a computer program?


What is time complexity and space complexity?

"Running Time" is essentially a synonym of "Time Complexity", although the latter is the more technical term. "Running Time" is confusing, since it sounds like it could mean "the time something takes to run", whereas Time Complexity unambiguously refers to the relationship between the time and the size of the input.


What is the difference between procedure and algorithm?

A procedure can go on forever.Where as an Algorithm, will eventually terminate and will have each step precisely defined.


Difference between greedy algorithm and dynamic programming?

the basic difference between them is that in greedy algorithm only one decision sequence is ever generated. where as in dynamic programming many decision sequences are generated.


What is the difference between polynomial and non polynomial time complexity?

Polynomial vs non polynomial time complexity


Difference between Bresenham and midpoint circle drawing algorithm?

what is difference between mid-point and bresenhams circle algorithm what is difference between mid-point and bresenhams circle algorithm bresenhams circle algorithm results in a much more smoother circle,comparred to midpoint circle algorithm..In mid point,decision parameter depends on previous decision parameter and corresponding pixels whereas in bresenham decision parameter only depends on previous decision parameter...


What is the difference between an algorithm and flow chart WITH examples?

An algorithm is a method of solving a problem. A flow chart is a tool for visualizing algorithms.


What is the difference between advanced encryption algorithm and encryption algorithm?

People have developed many encryption algorithms. One particular encryption algorithm is the Rijndael algorithm, usually called the AES or Advanced Encryption Standard.


What are the difference between greedy algorithm and dynamic programing?

A greedy algorithm is similar to a dynamic programming algorithm, but the difference is that solutions to the subproblems do not have to be known at each stage; instead a "greedy" choice can be made of what looks best for the moment.