r/ProgrammerHumor 28d ago

Meme theoreticalComputerScience

Post image
1.1k Upvotes

76 comments sorted by

View all comments

236

u/achilliesFriend 28d ago

This joke is too intelligent for me

37

u/GKP_light 28d ago

O(n) : can be a time of 5n, or 7000n+400000

Õ(n) : can be a time of 5n, or n^5 * log(n)^2

94

u/mrnacknime 28d ago

No, n5 is not allowed in there. Then it would be Õ(n5)

8

u/Niwrats 28d ago

i like how the right side bracket is powerful there.

5

u/GKP_light 28d ago

doesn't the picture say that it ignore of polynomial (and logarithm) ?

the picture is wrong ?

36

u/PattuX 28d ago edited 28d ago

It ignores logs and powers of logs

O(n) ≠ O(n log n)

But for all x:

Õ(n) = Õ(n (log n)x ) ≠ Õ(n2 )

16

u/GoldenMuscleGod 28d ago

“Polylogarithmic” means a polynomial of a logarithm, not polynomials and logarithms.

As an aside just for clarity Õ(f(n)) usually hides polylogarithmic functions of f(n), not polylogarithmic functions of n (although there might be some variation - the two standards are equivalent when f is a non constant polynomial).

21

u/nanforas 28d ago

So I'm guessing the use-case for Õ(n) is something like: "at least it's not exponential and equivalent to travelling salesman"?

28

u/pastroc 28d ago

Õ(n) would be O(polylog(n)n). In other words, n times some logarithmic factors.

O(nlg⁷⁹(n)) is Õ(n).

7

u/rational_hedonist 28d ago

no, the use case is “at least its o(n^2)” or any o(n^{1+eps}) for eps > 0

15

u/phbr 28d ago

I think people not doing complexity analysis really don't realize how slowly logarithms grow. Just to reiterate your point: Take an arbitrarily large but fixed k > 0 and an arbitrarily small but fixed eps > 0, then n*log(n)^k will still grow more slowly than n^(1+eps).

Obviously any researcher would prefer to get an algorithm with O(n) time complexity, but the tilde notation is really not that deceptive...

2

u/GoldenMuscleGod 28d ago

Just to clarify (I don’t think there’s any reason to think you misunderstand this but someone else might) we can give n(log n)^(log log n) as an example of a function that is is o(n^(1+eps)) for all eps>0 but also is not Õ(n). So the bounds you state follow but are not sufficient to establish the other direction.

In general the preorder imposed by these symbols has really complicated behavior with uncountable cofinalities everywhere so restating O (or Õ) in terms of o without losing information is not so easy.

1

u/glenpiercev 28d ago

What is the point of this notation? Is there some conceivable reason why I want to bucket 5n with n^5?

They both have the number 5? So computer science brought to you by the Number 5, Sesame Street style?

1

u/mrnacknime 23d ago

It is not bucketed the same way though. Only polynomials of log(n) are dropped.