Question

Justify the argument that an algorithm is efficient if its running time complexity can be expressed...

Justify the argument that an algorithm is efficient if its running time complexity can be expressed as a polynomial function of the problem size.

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

It is not easy to build an algorithm that takes time proportional to the size of the problem. For example, if the size of the array is n and you want to find a pair in the array such that the sum equals to the target value. It is difficult to create an algorithm that can do the task in time O(n) . The task can be easily done in time O(n^2) by just checking the sum for each pair possible. But in order to do in O(n) time, it is not that easy. It can be done in O(n) time if the array is sorted by taking two pointers to the starting and ending of the array and then incrementing and decrementing the pointers accordingly till we get the required pair. It takes time O(n) with a condition that the array is sorted. But in a normal case, the array is not sorted. To sort, we need additional time O(nlogn)and also the time O(n). Hence, the total time is O(nlogn+n) which is greater than O(n) Hence, it is difficult to create such algorithms. So, if running time complexity can be expressed as a polynomial function of the problem size, then the algorithm is efficient.

Add a comment
Know the answer?
Add Answer to:
Justify the argument that an algorithm is efficient if its running time complexity can be expressed...
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