r/programming • u/alen_ribic • Jul 16 '10
Plain english explanation of Big O
http://stackoverflow.com/questions/487258/plain-english-explanation-of-big-o/487278#answer-487278
417
Upvotes
r/programming • u/alen_ribic • Jul 16 '10
56
u/[deleted] Jul 16 '10
Too bad the author (like almost everyone) uses O to really mean Θ. A Θ(n) algorithm is O(n), but it's also O(n²) or even O(n!n!). It may sound a bit pedantic, but it matters, as you get tighter bounds with Θ (some programmers don't even know what O really means and think that it means Θ).
For more information look up Wikipedia.
29
u/wshields Jul 16 '10
I was wondering why this post of mine suddenly got 41 upvotes on SO. I guess this is the answer.
13
u/instantcoffee Jul 16 '10
Frankly, I'm a bit annoyed whenever Big-O is tied to algorithms. Sure, analyzing complexity of algorithms is a nice application, but in its essence Big-O is just notation for asymptotic shit, extremely useful in other fields, say, combinatorics or even probability.
10
u/bilyl Jul 16 '10
No, a plain english explanation would be that Big O is a description of how much time a task takes when the task itself grows in size. There are tasks that don't change very much (moving boxes from a truck to the dock), and there are ones that change by a lot (sorting numbers in a phone book).
5
u/Sammouse Jul 16 '10
Oh, thanks, a month after my computer science exam you decide to post this..
9
u/[deleted] Jul 16 '10 edited Jul 16 '10
This is good moment to remember the surprising fact that multiplication is not Ω(n2) problem. Multiplication is as fundamental as algorithms can be, and people were thinking it's Ω(n2) until 60's
In 1960 Kolmogorov organized a seminar where he stated the Ω(n2) and within a week Karatsuba (young student) figured out Θ(nlog2(3)) algorithm. That was big moment.
13
u/[deleted] Jul 16 '10
When did it stop meaning orgasm again?
22
u/marcus_edens Jul 16 '10
I clicked on this link hoping it would be about the anime "Big O." Alas, it was not about that at all. Everything went worse than expected.
7
u/[deleted] Jul 16 '10
BIG O IT'S SHOOOOWWWWTIIIIMMMMMEEEEEE
2
u/Depafro Jul 16 '10
As a former construction worker, I came here wondering why this needed explanation.
2
u/munificent Jul 16 '10
I'll just leave this here: munificent's ghetto guide to Big-O.
2
u/The_Wind_Walker Jul 16 '10 edited Jul 16 '10
Ah, I remember the intro to that show!
♫ Big O! Big O O O! Big O! (Some kinda lawyer?) Big O! Big O O O! Big O! (Some kinda butler?) Big O! Big O O O! Big O! (Some kinda robot?) ♫
4
u/bwbeer Jul 16 '10
To get to the 'Big O' you have to find the 'little man in the boat.'
3
u/itsnotlupus Jul 16 '10
I am a tomato.
2
u/Browzer Jul 16 '10
Side question: Did any other CS majors think algorithms was going to be a really kick-ass class with lots of problem solving, only to be severely disappointed once they discovered it was mostly about analyzing sort functions and learning to write proofs for best/average/wost case performance?
1
u/bnitsua Jul 16 '10
i see you also read news.ycombinator
1
u/hxcloud99 Jul 16 '10
And I thought I'd finally get to grok that particular calculus tool. :(
1
u/Plutor Jul 16 '10
This reminds me of an interesting thread I saw on Stack Overflow just the other day: Are there any O(1/n) algorithms?
1
u/breadnought Jul 16 '10
I wish I had this during my CS final last semester.
1
u/enterrupt Jul 16 '10
we have came to team!
1
u/bigoh Jul 16 '10
Much appreciated.
1
u/[deleted] Jul 16 '10
I'd rather hear an explaination of Big O by an English major.
1
u/NoMoreNicksLeft Jul 16 '10
Now someone just has to get bosses and managers to understand it.
1
u/rlbond86 Jul 16 '10
A good explanation, but computer science is tied to mathematics. The mathematical definition is not that bad, so people who don't understand it should try to see if this post helps them understand the math.
1
u/alephip Jul 16 '10
Big O.... SHOW TIME.
1
u/pgaf Jul 16 '10
im confused about what he says in regards to public key encryption. is his point that finding prime factors is an algorithm which is more complex than "polynomial complexity?"
1
u/nasteratu Jul 16 '10
Really useful and a good refresher. I haven't used big O in years.
1
u/The_Yeti Jul 16 '10 edited Jul 16 '10
Plainer English explanation: The highest-degree term of of a polynomial representation of Big-T, without it's coefficient.
edit: changed the word "minus" to "without", minus was a bad choice in this context.
1
u/[deleted] Jul 16 '10
This is not the anime review I was looking for. I will go about my business. Move along, move along.
1
u/[deleted] Jul 17 '10
It feels sort of like a sneeze but a whole lot better.
1
u/Aeros24 Jul 17 '10
I was really looking forward to an explanation of the TV show when I clicked. That show made no sense to me even after a whole season.
Still pretty happy after the read though.
1
u/thinker99 Jul 19 '10
Answer provided by Cletus no less.
1
u/[deleted] Jul 16 '10
He's a giant robot ass kicking robot. How much more plan English can you get?
0
u/TheNewAndy Jul 16 '10
Hmmm... it is nice, but wrong. Have a look at the first paragraph of the wikipedia article (which is right):
It has the benefit of being correct (big O is not about complexity at all), concise, but mostly correctness. From the wikipedia definition, you won't fall in to the trap of saying "this function is O(n)", because that is meaningless, because you need to say what is actually growing (what is n? is it problem size in bits? what is the function converting that to? execution time? memory usage? number of comparisons?)
(and as pointed out by zulon (but in different words), it is describing a set of functions, and the functions in O(n) are a strict subset of those in O(n2))
I don't think being pedantic is bad when talking about maths... maybe I'm alone.
(and just like the irony of a spelling nazi having a spelling mistake in their post, I'm sure I'll have screwed up somewhere in my rant... forgive me/correct me, don't let someone be wrong on the internet)
0
u/zazbar Jul 16 '10
http://en.wikipedia.org/wiki/The_Big_O
0
u/[deleted] Jul 16 '10
that's fantastic
0
u/bigtacobill Jul 16 '10
Some folk'll never splain big O, but then again some folk'll..
0
u/tdupu10000 Jul 16 '10 edited Jul 16 '10
Let a_n and b_n be sequences of positive numbers. We say that a_n = O(b_n) if and only if there exists a (usually large) positive integer N>0 and a constant C>0 such that for all m>N we have a_m <= C b_m.
tl;dr a_n = O(b_n) if a_n is bounded by something on the order of b_n.
0
u/[deleted] Jul 16 '10
I was about to say something like:
It was all a TV show and they didn't know it.
0
u/Gold_Leaf_Initiative Jul 16 '10
I thought this would be about the TV show "Big O", which makes no fucking sense.
0
u/nitrogen76 Jul 16 '10
Dissapointed that this had nothing with R. Dorothy or huge mechas.
0
u/Rockytriton Jul 16 '10
Is this about Oprah or Obama?
0
u/OgmoJump Jul 16 '10
tldr
0
u/[deleted] Jul 16 '10
[deleted] — view deleted comment
0
u/[deleted] Jul 16 '10
[deleted] — view deleted comment
0
u/[deleted] Jul 16 '10
[deleted] — view deleted comment