The Gateway to Computer Science Excellence
0 votes
101 views

If both of the algorithms A and B need O(nlogn) time then they
both are equally efficient and finish in same amount of time.

TRUE OR FALSE

in Algorithms by Boss (17.7k points) | 101 views
0
it should be true..
0

@SHUBHAM SHASTRI

what happens if we take A = O(n) and B = O(n log n), then also given statement is true?

Otherwise i can't take like that?

+2

for(i=0;i<n;i++)

{

    count++;

}

time complexity is O(n) =O(n2) =O(n3)

But we generally denote with O(n) but it doesn't mean T(n) = O(n2) is wrong., it is also correct.

0
yes yes ..i got it ..you are correct ..
0
My doubt is that even if both algorithm has tightest upper bound as nlogn still it doesn't mean they will take exactly equal amount of time. It's approximation. Isn't it?
0
yes
0
So it should be false ?
+1
When w write O(nlogn) we don.t write the constant like O(nlogn+n) or O(nlogn*k) k is constant

Consider a real-life example the best case of Quicksort is faster than heap and merge because of constant associated with it

1 Answer

+3 votes

Measuring  the time complexity and the exact time are two different things, the asymptotic  notations gives us  approximation about the dependency of the number of steps with respect to the input size and the the exact time can be measured using the system clock .

The answer is false.

by Active (1.2k points)
0
nicely written,but change the color of the font please,its unreadable

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,321 answers
198,387 comments
105,140 users