Question

Assume that an O(log2N) algorithm runs for 10 milliseconds when the input size (N) is 32....

Assume that an O(log2N) algorithm runs for 10 milliseconds when the input size (N) is 32. What is input size makes the algorithm run for 14 milliseconds?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Assume F(n) is the function for the run time of an algorithm.

Then, F(n) = c log2n for some constant say c.

F(32) = c log232 = 10

=> 5c = 10, Hence c = 2

Similarly,

F(n) = 2 log2n = 14, Hence log2n = 7

=> n = 27= 128

Therefore, the input size which makes the algorithm run for 14 milliseconds is 128 (N).

Add a comment
Know the answer?
Add Answer to:
Assume that an O(log2N) algorithm runs for 10 milliseconds when the input size (N) is 32....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT