8

In the question in this video about quicksort luckily picking the median in each recursive call. Tim Roughgarden, the presenter, says at 11:22

Partition needs really linear time, not just $O(n)$ time.

What does he mean here? I thought linear time is $O(n)$. Does he mean $\Theta(n)$ or something else? I see how partition in quicksort here would be $\Theta(n)$ but I don't get the part that says "not just $O(n)$ time".

Inuyasha Yagami
  • 6,277
  • 1
  • 12
  • 23
heretoinfinity
  • 649
  • 1
  • 6
  • 16

2 Answers2

8

Usually we call statement $A$ stronger than $B$ when $A$ implies $B$: $A \Rightarrow B$ (weaker-stronger). In other words, $B$ is weaker than $A$.

When the presenter is speaking about linear time for partition, this is a stronger statement than $O(n)$ time. All linear functions are in $O(n)$, but it also contains non-linear functions.

For example: $\sin n, \frac{1}{n}, \sqrt{n} $ are all in $O(n)$, but they are not linear. As was written in a comment, $O(n)$ is the set of functions bounded by linear functions, but not the set of only linear functions.

To be linear gives more information than to be in $O(n)$, to be in $\Omega(n)$, even to be in $\Theta(n)$.

zkutch
  • 2,389
  • 1
  • 9
  • 14
3

The partition needs really linear time

Here, the presenter meant that partition takes $\Omega(n)$ time.

not just $O(n)$ time

Here, the presenter meant that this is a loose or weak statement. A stronger statement would be that partition takes $\Omega(n)$ and $O(n)$ time, which is equivalent to $\Theta(n)$, as you are saying.

Inuyasha Yagami
  • 6,277
  • 1
  • 12
  • 23