Question

Consider the following activities. Solve the probl

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

The algorithm for ativity selection problem:

  • Sort the activities according to their finishing time
  • Select the first activity from the sorted array and print it.
  • Do following for remaining activities in the sorted array.
  • .a) If the start time of this activity is greater than the finish time of previously selected activity then select this activity and print it.

The solution to above problem:

step 1: sort the activities according to their finish time

i 2 3 1 5 4 6
si 1 3 0 5 5 8
fi 2 4 6 7 9 9

Step 2: select the first activity and print it

output : 2

Step 3: si(activity(3)) > fi(activity(2)

output: 2,3 and repeat the steps,

si(activity(1)) < fi(activity(3))

output: 2,3

si(activity(5))>fi(activity(3))

output : 2,3,5

finally si(activity(6))>fi(activity(5))

so output: 2,3,5,6

so ,the activities that are selected are 2,3,5,6

Add a comment
Know the answer?
Add Answer to:
Consider the following activities. Solve the problem of activity-selection problem.
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
  • Consider the following variation on the Activity Selection Problem.You have a resource that may be used for activities...

    Consider the following variation on the Activity Selection Problem.You have a resource that may be used for activities 24 hours a day,ever day.Activities repeat that may be used for activities repeat on a daily basis. As in the original problem, each activity has a start time and as end time.If an activity is selected, it will exclusively use the resource during the duration between the start and end time(i.e., no other activity may be scheduled during this time). Note that...

  • Consider a modification to the activity-selection problem in which each activity ai has, in...

    Full question from above:"Consider a modification to the activity-selection problem in which each activity ai has, in addition to a start and a finish time, a value vi. The objective is nolonger to maximize the number of activities scheduled, but instead to maximize the total value of the activities scheduled. That is, we wish to choose a set A ofcompatible activities such that [summation, sub k in A, of v sub k] is maximized. Give a polynomial-time algorithm for this...

  • In activity selection problem, of all the allowed activities we always picked the activity that ends...

    In activity selection problem, of all the allowed activities we always picked the activity that ends first. Is picking the allowed activity that starts last a good greedy choice? When is it appropriate to use the dynamic programming approach - describe and explain the prerequisites. What is the difference compared to greedy approach? What is optimal substructure? Explain with an example. For problems that exhibit greedy-choice property, why is greedy approach preferable to dynamic programming approach?

  • A) Write the pseudocode for an algorithm using dynamic programming to solve the activity-selection problem based...

    A) Write the pseudocode for an algorithm using dynamic programming to solve the activity-selection problem based on this recurrence: c[i, j] = 0 if Si; = Ø max {c[i, k] + c[k,j] + 1} if Sij +0 ak eSij B) Analyze the running time (the time complexity) of your algorithm and compare it to the iterative greedy algorithm.

  • Consider the following set of activities: Time Predecessor Activity Required Activities A 5 None B 4...

    Consider the following set of activities: Time Predecessor Activity Required Activities A 5 None B 4 A C 5 B D 8 B E 9 C F 6 C,D G 8 D H 3 E,F,G a.     Draw the CPM network for this problem. b.     Calculate and summarize the earliest and latest start and finish times, the slack for each activity, and the critical activities. c.     What is the earliest time that the project can be completed? d.     If the project needed to be completed...

  • Exercise 3 (20 points) This exercise is about the greedy approach to the activity-selection probl...

    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 some cases the elimination of the first activity to finish from the set of activities can lead to a larger set of mutually compatible activities. Is James right or wrong? Prove your answer Exercise 3 (20 points) This exercise is about the greedy approach to the activity-selection problem. James claims that in some cases...

  • Q4. CPM Consider the following list of activities and predecessors. Activity ProcessorsDuration (...

    Q4. CPM Consider the following list of activities and predecessors. Activity ProcessorsDuration (days) Build foundation Build walls&ceilin Build roof Complete electrical wirin Put in windows Put on sidin Paint house C,F a)Draw the network diagram. Write down the LP to determine the completion time. b)Suppose that by hiring additional workers, the duration of each activity can be reduced. The costs per day of reducing the duration of the activities are given in the following table. Write down the LP to...

  • Consider the following project activities: Calculate the expected time (te) for each activity. Draw an Activity...

    Consider the following project activities: Calculate the expected time (te) for each activity. Draw an Activity on Node (AON) diagram to reflect the flow of these activities. Calculate the Early Start (ES), Early Finish (EF), Late Start (LS), and Late Finish (LF) for each activity. Calculate the slack for each activity. Identify all activities on the Critical Path. Use the data to calculate the probability the project will finish in 20 weeks (Hint: z-score). Activity A 8 с D E...

  • Consider the following precedence chart: ACTIVITY PRECEDING ACTIVITIES OPTIMISTIC TIME (days) PESSIMISTIC TIME days) MOST LIKELY...

    Consider the following precedence chart: ACTIVITY PRECEDING ACTIVITIES OPTIMISTIC TIME (days) PESSIMISTIC TIME days) MOST LIKELY TIME (days) 10 10 10 B.C DE The total slack for activity D is O 2 O O O

  • Problem 5-7 The following activities are part of a project to be scheduled using CPM: ACTIVITY...

    Problem 5-7 The following activities are part of a project to be scheduled using CPM: ACTIVITY IMMEDIATE PREDECESSOR TIME (WEEKS) А 7 B 6 2 3 B.D D b. What is the critical path? Оооо A-C-D-E-G A-B-D-F-G A-B-E-G O A-C-D-F-G c. How many weeks will it take to complete the project? Number of weeks d. How much slack does activity B have? Slack of activity B week(s)

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