in Algorithms
878 views
2 votes
2 votes
Which one of the following notations is most relevant for finding the best algorithm for a problem?

(A) $o(f(n))$

(B) $O(f(n))$

(C) $\omega (f(n))$

(D) $ \Omega (f(n))$
in Algorithms
878 views

4 Comments

@toxicdesire

"Θ(f(n)) seems to be most accurate answer, but it's not an option. If Θ(f(n)) is the correct answer, does that not mean both O(f(n)) and Ω(f(n)) are equally relevant?"

yes, For example, in case of "sorting" problem, Heap Sort and Merge-Sort are asymptotically optimal comparison sorts which is given as corollary above because in worst case, $O(nlgn)$ and $\Omega(nlogn)$ matches which implies $\Theta(nlgn)$. So, we can say "best" algorithm for comparison based sorting is merge and heap sorts whose running time is represented by  $\Theta(nlgn).$ So, here Theta,Big Omege, Big Theta all says that we found the best algorithm for sorting which work for all inputs.

"Now, let's say there's a problem A. Now, let's assume lower bound to the problem A is Ω(n⋅logn). Now assume the problem can be solved with two algorithms, both have Ω(n⋅logn) as lower bounds. Tell me which one is the best one? "

suppose, you have proved same lower bound for "no. of comparisons" by both algorithms then I will check how much memory will be taken by both algorithms and other parameters and then say which is optimal.

"What gives Ω(f(n)) an edge over O(f(n)) for choosing best algorithm to a problem?"

  Ω(f(n)) gives lower bound means can we do better than something or not. For example, we can't sort numbers or anything with less than nlgn comparisons (or) we can't do better than nlgn.  Lower bounds are harder to prove. 

1
1

@ankitgupta.1729 Alright. got it. Also, 

suppose, you have proved same lower bound for "no. of comparisons" by both algorithms then I will check how much memory will be taken by both algorithms and other parameters and then say which is optimal.

- Won't we check the upper bounds of the two algorithms first, and choose one with lower $O(f(n))$?

1
1

@toxicdesire yes, we will check.

0
0

Please log in or register to answer this question.

Related questions

0 votes
0 votes
0 answers
1