-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
You are misunderstanding O vs. Theta. #140
Comments
Came here to say this. Easy to misunderstand it. 👍 |
Can you elaborate for us common folk? |
@mtheos these exercises on Khan Academy explain it well https://www.khanacademy.org/computing/computer-science/algorithms/asymptotic-notation/a/asymptotic-notation The gist is that O, Theta, and Omega are different sets of mathematical “bounds”. O is an upper bound only, Theta is an upper and lower bound, and Omega is a lower bound only. You can put upper and lower bounds on anything, including the average and best cases of an algorithm. The Big O (upper bound) of a best case linear search is O(1). The Big O of a worst case linear search is O(n). Notice for best case I did not use Omega. Upper bound does not mean worst case, it is mathematical concept simply meaning some line that (when the inputs are large enough) will always be above or equal to the line it’s a bound over. |
You seem to be making the common mistake of thinking big-Theta means average case and big-O means worst case, which is not correct.
Either big-O or big-Theta or big-Omega can be used meaningfully to describe any of best, average, or worst case -- the concepts are completely orthogonal.
To be mathematically accurate your page should have Theta everywhere.
The text was updated successfully, but these errors were encountered: