Lets Take Binary search for instance, The best case running time would be obtained in First comparison when
key_to_find == (imin + imax) / 2;
And the best case running time would be represented by O(1). I Completely understand that but what confuses me is why O(1) is used and why I can’t use Θ(1) or any other notation for same.
i.e . How to identify which notation should I use to represent the Running time(Best, Average or Worst case).
O-notation and Θ-notation are not directly related to best-case, average or worst case.
They are use for asymptotic bounds of functions.
You can write:
47n lg n = O(n lg n),
3n^2 + 4n = O(n^2)
And there is a difference between O a Θ notation. O means “at most (using some constant factor)”, Θ means “equal (using some constant factor)”, e.g.:
47n ln n = O(n^2), but it’s not Θ(n^2).
If you want to express best case, average case or worst case, you usually write them explicitly:
“Best case is O(1) (or Θ(1)), average case is O(lg n), worst case is O(n).”
Sometimes you also “running time is O(x)”, then you mean, running time is at most proportional to x. If you say “running time is Θ(x)”, then you mean, running time is always proportional to x.