Question

Two Level 200 IT students, Afiriyie and Agyemang, are discussing how to compare two algorithms for...

  1. Two Level 200 IT students, Afiriyie and Agyemang, are discussing how to compare two algorithms for solving a given problem. James suggests that they should use the execution times of the algorithms as criterion; but Morris insists that they should use the number of statements the algorithms execute as criterion.

  1. Explain the reasons why both criteria they are considering are not good for comparing algorithms.

  1. Recommend an ideal solution/criterion that they should rather use for comparing algorithms. Give a practical example to illustrate your answer.

Homework Answers

Answer #1

1.

The reason considering any of the criterions mentioned is that

If the first criterion is taken into account, we may choose the algorithm with lesser execution time as compared to others but just depending upon this we can't judge how efficient the algorithm is. It may provide faster results but if the space is increased then it won't work. Hence considering only the execution view is not suitable.

If the second criterion is taken into account, the higher the statements executed the better. But this will drastically slow down the process. Hence taking the number of statements executed alone will not show the side effects and important factor that is speed.

Now if both the alogorithms are compared in this way, each of it will lack in something.

2.

An ideal solution to compare the algorithms can be considering complexity, both time and space.

Example :

First define the purpose of your algorithm

Merge sort vs Bubble sort-

Space-wise Bubble sort requires less memory, while Merge sort requires more

Time-wise Bubble sort takes more time, while Merge sort requires less

So if we were to choose between these both algorithms, we choose Bubble where memory is limited and Merge when there's a lot of space. But usually the preference would go to Merge if the memory is present as the time complexity is O(nlogn), whereas for Bubble it's O(n).

comment for any clarifications!

Know the answer?
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
Similar Questions
  Canadian Whisky: Capitalizing on World Recognition A Thirst for More Rick Clemens opened an independent whisky...
  Canadian Whisky: Capitalizing on World Recognition A Thirst for More Rick Clemens opened an independent whisky distillery 15 years ago in a small town in British Columbia, Canada. Since that day, his business has slowly grown, gaining first a local, then regional and finally national following. It has since grown from a two-person operation to a thriving business with an in-house team of six and the contracted services of an off-site bottler and distributor. After many years of operating at...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From the April 2004 Issue Save Share 8.95 In 1991, Progressive Insurance, an automobile insurer based in Mayfield Village, Ohio, had approximately $1.3 billion in sales. By 2002, that figure had grown to $9.5 billion. What fashionable strategies did Progressive employ to achieve sevenfold growth in just over a decade? Was it positioned in a high-growth industry? Hardly. Auto insurance is a mature, 100-year-old industry...
read Seasons of Love chapter:measuring a child's life after suicide. please answer the questions : reflect...
read Seasons of Love chapter:measuring a child's life after suicide. please answer the questions : reflect on what happens to the families when there is a suicide in the family, based on the Seasons of Love chapter...how should people be told? What details are best left unshared? below is the story These theories may have a certain face-validity, but they often neglect environmental or contextual factors that are innate to answering the question of “why” a person might engage in...
Using the model proposed by Lafley and Charan, analyze how Apigee was able to drive innovation....
Using the model proposed by Lafley and Charan, analyze how Apigee was able to drive innovation. case:    W17400 APIGEE: PEOPLE MANAGEMENT PRACTICES AND THE CHALLENGE OF GROWTH Ranjeet Nambudiri, S. Ramnarayan, and Catherine Xavier wrote this case solely to provide material for class discussion. The authors do not intend to illustrate either effective or ineffective handling of a managerial situation. The authors may have disguised certain names and other identifying information to protect confidentiality. This publication may not be...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT