DSA, Database System & Operating System — Data Structure, Lists, Linked Lists and Trees, NEC licence examination syllabus (Nepal Engineering Council).
The single most foundational skill in this entire subject — everything else builds on top of this.
Before comparing two algorithms by actually running them (which depends on hardware, compiler, mood of the CPU), computer scientists needed a hardware-independent way to describe "how much work does this actually do as input grows?" That's exactly what Big-O gives you.
Big-O (O)Upper bound — the WORST case growth rate. "This algorithm never does worse than this."
Omega (Ω)Lower bound — the BEST case growth rate. "This algorithm never does better than this."
Theta (Θ)Tight bound — used when best and worst case grow at the SAME rate, giving an exact characterization.
All three notations are defined correctly above, yet almost every complexity claim you meet is Big-O. There is a reason, and it is not laziness.
An upper bound is a guarantee. "This never does worse than n log n" is something you can build a system on. A lower bound tells you the algorithm is at least this slow sometimes, which is rarely what you need to know when deciding whether it will meet a deadline.Best case and lower bound are not the same thing, and treating them as synonyms is a standard exam trap.
CaseWhich INPUT you are considering — best, average or worst. A property of the data.
BoundWhich side you are bounding from — O above, Ω below, Θ both. A property of the mathematics.
They combine freely. It is entirely legitimate to state the Big-O of the best case, or the Omega of the worst case. Insertion sort is O(n) in the best case and O(n²) in the worst; both are upper bounds, on different inputs.
Constants and lower-order terms are dropped, so 3n² + 500n + 2000 is simply O(n²). That is a feature — it makes the comparison hardware-independent — but it means Big-O says nothing about which algorithm is faster on any particular input size.
An O(n²) algorithm with small constants routinely beats an O(n log n) one on small inputs, which is why real sort implementations switch to insertion sort on small partitions. Big-O describes how cost grows, not what it is.
Create a free account to tick topics off, take notes as you read, watch the video lessons and get a day-by-day study plan built around your exam date.
Loading…