Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • $\begingroup$ So am I wrong is saying that the time complexities of both average case and worst case are both θ(n)? $\endgroup$ Commented Mar 2, 2016 at 8:56
  • $\begingroup$ Yes, that's incorrect in general. Your professor was right when she suggested you find out yourself why. I tried to give you a hint in my answer. $\endgroup$ Commented Mar 2, 2016 at 8:57
  • $\begingroup$ Here n is the input size and m is a constant. If generally θ(kn) = θ(n) where k is a constant, then why is θ(1/m * n) ≠ θ(n) where 1/m is a constant. $\endgroup$ Commented Mar 2, 2016 at 9:04
  • $\begingroup$ We don't think of $m$ as constant, since it's not really constant. Different instances of the data structure can have widely different $m$. It's as if you would say that the space is $O(1)$ rather than $\Theta(m)$. $\endgroup$ Commented Mar 2, 2016 at 9:42
  • 1
    $\begingroup$ Whenever you run an algorithm on a particular input, all the parameters are fixed. That doesn't mean that when we compute the asymptotic performance of an algorithm we assume that they are constant. In other words, $m$ and $n$ are both values of the same "type". You can call them parameters, but that's not a particularly good term. $\endgroup$ Commented Mar 2, 2016 at 12:02