edited by
1,637 views
0 votes
0 votes

Three algorithms do the same task. Algorithm One is $O(N)$ and Algorithm Two is $O(\log N)$ and Algorithm Three is $O(N1/2)$. Which algorithm should execute the fastest for large values of $N$?  

  1. $O(N1/2)$
  2. $O(N)$
  3. $O(\log N)$
  4. both A and B
edited by

1 Answer

Best answer
2 votes
2 votes
To find out the fastest execution for a given upper bound , just check the behaviour of the functions(upper bound) for large values of N....the lower the value,  faster the execution

Here in this case its obvious that logn < n^1/2 for large values of N as you can check from their graph too..and therefore logn < n (obvious) so logn - c is correct option
selected by
Answer:

Related questions

1 votes
1 votes
3 answers
2
0 votes
0 votes
0 answers
3
1 votes
1 votes
1 answer
4
Bikram asked Nov 26, 2016
842 views
Consider an array of elements $6 \ 4 \ 5 \ 3 \ 7 \ 1$. The contents of the array after three passes when we apply Bubble Sort on it is$3 \ 4 \ 1 \ 5 \ 6 \ 7$$3 \ 4 \ 5 \ ...