The Gateway to Computer Science Excellence
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
in Programming by Veteran (75k points)
edited by | 64 views

1 Answer

+2 votes
Best answer
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
by (437 points)
selected by
@bikram sir, Isn't C correct? I did mark option C but got negative marks for that. The correct ans given is '3' in the result.
Yes, C is the correct answer . Your answer is correct , i fixed that issue , now marks will increase i think .

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,405 answers
105,468 users