Question
show all your work. justify your answer
Exercise 3 (20 points) This exercise is about the greedy approach to the activity-selection problem. James claims that in som
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Activity selection problem is a problem in which a person has a list of work to do. Each of the activities has a starting time and ending time . We need to schedule all these activities in such a way that the person can complete a maximum number of activities. Since the timing of the activities can collapse, so it might not be possible to complete all activities and thus we need to schedule the activities in sach a way that the maximum number of activities can be finished.

EXAMPLE : Look at the table containing activities with their start and end times.

Activity (a)1 4 6 2 0 2 3 4 3 Si 4 3 6

Here si and fi are the starting and the finishing time of the activity ai.

Activity 1 Activity 2 Activity 3 Activity 4 Activity5 0 3 6

GREEDY APPROACH

We want to adjust the maximum number of activities to be completed . So, choosing the activity which is going to finish first will leave us maximum time to adjust the later activities. This is basically an intuition that greedily choosing the activity with earliest finish time will give us an optimal solution. Thus, our next task is to verify our intuition.

VERIFYING GREEDY APPROACH

Suppose we have adjusted some activities in the given time slot and claiming that this solution is the optimal solution and fhe element first to be finished is not in this solution.

To finish first Scheduled Activities

Now we can replace the first activity in the slot with the element with first finish time without any consequences. As we are only concerned with the number of activites and by replacing the activity , the number of activies will be the same.

Replaced Free Space

This is even going to give us some free time in the slot which can be used to further optimize the problem. So, we need the element of least finish time in our optimal solution and thus we just theoretically verified that making a greedy choice will lead us to optimal solution.

SOLVING THE PROBLEM

Now we kn that greedily choosing the activity with least finish time will give us the optimal solution , so our first task would be to sort the activities with their finishing times.

Activity (ai) 3 4 5 0 4 Si 2 4 6 6 Sorted according to finish time

To take the element with the least finish time , we will iterate over the list of the activities and will select the first activity and then we will select the activity which is starting next after the currently selected activity finishes.

0 2 Took this 3 4 6 Then took this 4 First to start after 2 finishes Activity 1 Activity 2 Activity 5 0 3 6

Hence, we can say that James is right.

Add a comment
Know the answer?
Add Answer to:
Exercise 3 (20 points) This exercise is about the greedy approach to the activity-selection probl...
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
  • Activity Selection Last-to-Start | C++ Implementation Develop a program with a greedy algorithm that instead of always...

    Activity Selection Last-to-Start | C++ Implementation Develop a program with a greedy algorithm that instead of always selecting the first activity to finish, instead selects the last activity to start that is compatible with all previously selected activities. The program should read input from a file named “act.txt”. The file contains lists of activity sets with number of activities in the set in the first line followed by lines containing the activity number, start time & finish time. Example act.txt:...

  • The purpose of this exercise is to have students think about some of the issues that...

    The purpose of this exercise is to have students think about some of the issues that Congress debated from 1996-present as they tried to agree on privacy legislation. These issues do not have a right or wrong answer; there is legitimacy to each side. Not only were they important in the period right after HIPAA was initially passed, in some cases they have continued to be a subject of debate even today. Please submit 5 quality sentences for each issue...

  • Problem 3 (20 points) In the following figure, a horizontal force F is applied to a...

    Problem 3 (20 points) In the following figure, a horizontal force F is applied to a large block of mass M with a massless pulley attached to it. While the block M is moving to the right, the other two blocks mi and m2 remain stationary problem relative to M. All surfaces are frictionless for this (a) Draw separate free body diagrams for M(including the massless pulley), mi, and m2 respectively. On the free body diagrams, please only draw and...

  • Problem 3: Activity-Based Costing (20 points) University Student Cleanup provides housecleaning services to its clients (primarily...

    Problem 3: Activity-Based Costing (20 points) University Student Cleanup provides housecleaning services to its clients (primarily university students). During its first year, USC had a simple business model where it charged its customers $24 per hour for services while paying its cleaning specialists $12 per hour. The owner simply assumed the 100% markup over hourly direct labor costs would be enough to cover all additional costs and make a good profit. Unfortunately, this did not tum out to be the...

  • PHASE 2 FITNESS CENTER Allen Goldschmidt loves exercise and fitness. At age 42 he survived a...

    PHASE 2 FITNESS CENTER Allen Goldschmidt loves exercise and fitness. At age 42 he survived a cardiac scare in which doctors first believed a heart attack had taken place. Even though subsequent tests determined such was not the case, Allen was told that being overweight and in poor physical condition might at some point lead to an actual episode. In response, he moved from a sedentary lifestyle to an activity-based approach to keeping trim and healthy. After several months of...

  • Identify 8 issues in regards to Recruitment and Selection, 3 issues for Labour Relation in the...

    Identify 8 issues in regards to Recruitment and Selection, 3 issues for Labour Relation in the following case study : You have recently been hired as an HR Consultant in the new HR Department of Outrage Video Games. Outrage is a five year old, upstart company, run by two very bright young men - Will Bates – President, and his best friend Steve Cobbs, Vice President. This is a very exciting change for you because Outrage, which literally started in...

  • Please attempt at problem dealing in Chi-Square (Goodness of Fit). Thank you 006Chapter 22 Exercise employment has acualy increased in the past 3 years, or whether the change in empleymens can be...

    Please attempt at problem dealing in Chi-Square (Goodness of Fit). Thank you 006Chapter 22 Exercise employment has acualy increased in the past 3 years, or whether the change in empleymens can be explained by random puecruations: What is a Type I error in this case? Whar is a Tipe Il error? 22.8.10 Imagine you are performing a statistical test to determine i Exercise 22.8.1 Sappose someone is trying to sell you a coin that favors heads. You snwch a cotm,...

  • Rocket Print Publishing – Case Analysis 20 points Rocket Print is a successful printing and publishing...

    Rocket Print Publishing – Case Analysis 20 points Rocket Print is a successful printing and publishing company in its third year. The University of Toledo has been outsourcing more and more of its printing needs. Rocket Print has managed to secure UT as a customer and has survived the challenges of new work that UT demanded in a very short time. Much of this work is to support the printing of customized eBooks. As the first term progressed with Rocket...

  • Sky Plasties: Activity-Based Costing System Case Study Mr. Sami Sultan, Chairman of Sky Plastics, was studying...

    Sky Plasties: Activity-Based Costing System Case Study Mr. Sami Sultan, Chairman of Sky Plastics, was studying a schedule showing the product costs for each of the company's three plastic water containers. He had been thinking of how to increase the while facing the international competition for plastic water containers. Usually, Sami time to review company's performance reports. Since profits were being made, Sami believed that company's exports did not spend a lot of accounting to was the responsibility of the...

  • Please read the article and answer about questions. You and the Law Business and law are...

    Please read the article and answer about questions. You and the Law Business and law are inseparable. For B-Money, the two predictably merged when he was negotiat- ing a deal for his tracks. At other times, the merger is unpredictable, like when your business faces an unexpected auto accident, product recall, or government regulation change. In either type of situation, when business owners know the law, they can better protect themselves and sometimes even avoid the problems completely. This chapter...

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