Tight bound of worst case performance of algorithm

627 Views Asked by At

I am trying to find the "tight bound of an algorithm for the worst case run time. I have found that the upper bound of the worst case is O(n), I have also found that the lower bound for the worst case is

$$p=\left\lceil \frac{\sqrt{1+8x}-1}2 \right\rceil$$

$$p=\left\lceil \frac{\sqrt{1+8x}-1}2 \right\rceil \ge \sqrt{n}$$

Does this mean the lower bound on the worst case is $\Omega \sqrt{n}$

1

There are 1 best solutions below

0
On

That is correct. Just eyeballing it, we see a linear term $x$, and all other constants. The $x$ term is within a square root, so we have $\Omega(\sqrt{x})$ as the lower bound. However, you can also tighten the upper bound some. This function $p(x) \in O(\sqrt{x})$, which means $p(x) \in \Theta(\sqrt{x})$.

So as an easy example, if we set $\sqrt{x} \leq p(x) \leq 10\sqrt{x}$, we have satisfied the definitions of both Big-O and Big-Omega.