Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use C++ for implementation. Problem 5: (10 points) Activity Selection Last-to-Start Implementation Submit a copy of all your files including the txt files and

Please use C++ for implementation.

image text in transcribed

Problem 5: (10 points) Activity Selection Last-to-Start Implementation Submit a copy of all your files including the txt files and a README file that explains how to compile and run your code in a ZIP file to TEACH. We will only test execution with an input file named act.txt. You may use any language you choose to implement the activity selection last-to-start algorithm described in problem 4. Include a verbal description of your algorithm, pseudocode and analysis of the theoretical running time. You do not need to collected experimental running times. 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: 114 235 306 457 539 659 7 6 10 8811 9812 10 2 14 11 12 16 3 6 8 179 2 12 In the above example the first activity set contains 11 activities with activity 1 starting at time 1 and finishing at time 4, activity 2 starting at time 3 and finishing at time 5, etc.. The second activity set contains 3 activities with activity 3 starting at time 6 and finishing at time 8 etc. The activities in the file are not in any sorted order Your results including the number of activities selected and their order should be outputted to the terminal. For the above example the results are Set 1 Number of activities selected = 4 Activities: 2 4911 Set 2 Number of activities selected = 2 Activities: 2 1 Note: There is an alternative optimal solution for Set 1. Since activities 8 and 9 have the same start time of 8, a2 a4 a8 a11 would be an alternative solution. Your program only needs to find one of the optimal Problem 5: (10 points) Activity Selection Last-to-Start Implementation Submit a copy of all your files including the txt files and a README file that explains how to compile and run your code in a ZIP file to TEACH. We will only test execution with an input file named act.txt. You may use any language you choose to implement the activity selection last-to-start algorithm described in problem 4. Include a verbal description of your algorithm, pseudocode and analysis of the theoretical running time. You do not need to collected experimental running times. 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: 114 235 306 457 539 659 7 6 10 8811 9812 10 2 14 11 12 16 3 6 8 179 2 12 In the above example the first activity set contains 11 activities with activity 1 starting at time 1 and finishing at time 4, activity 2 starting at time 3 and finishing at time 5, etc.. The second activity set contains 3 activities with activity 3 starting at time 6 and finishing at time 8 etc. The activities in the file are not in any sorted order Your results including the number of activities selected and their order should be outputted to the terminal. For the above example the results are Set 1 Number of activities selected = 4 Activities: 2 4911 Set 2 Number of activities selected = 2 Activities: 2 1 Note: There is an alternative optimal solution for Set 1. Since activities 8 and 9 have the same start time of 8, a2 a4 a8 a11 would be an alternative solution. Your program only needs to find one of the optimal

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands-On Database

Authors: Steve Conger

2nd Edition

0133024415, 978-0133024418

Students also viewed these Databases questions

Question

4. Show the trainees how to do it again.

Answered: 1 week ago