Question

Suppose that an algorithm has run-time proportional to 2n , where n is the input size....

Suppose that an algorithm has run-time proportional to 2n , where n is the input size. The algorithm takes 1 millisecond to process an array of size 10. How many milliseconds would you expect the algorithm take to process an array of size 20 ?

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

1)

algorithm has runtime of 2

\frac{t1}{t2}=\frac{n1}{n2}

\frac{t1}{t2}=\frac{2^{20}}{2^{10}}=2^{10}=1024

so,\;t1=1024*t2

given\;t2=1millisecond

t1=1024\;milliseconds=1.024\;seconds

\color{Red}Answer:=1.024\;seconds

Note:\;\;if\;runtime\;is\;2n\;instead\;of\;2^n\;then\;answer\;is\;2\;milliseconds.

Add a comment
Know the answer?
Add Answer to:
Suppose that an algorithm has run-time proportional to 2n , where n is the input size....
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