Question

A student has too much work to complete before the deadline is due. Each assignment counts...

A student has too much work to complete before the deadline is due. Each assignment counts as a different part of the overall grade and each requires a different amount of time to complete.

How can we optimize the final grade (the student earns all of the points possible for each assignment) with a dynamic programming solution?

What would the runtime be of this solution and any complicating factors?

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

/*
Made By : Arun Kumar
Time Complexity : O(maxtime x numberofassignments)
Assumption : User is allowed to even fail in a subject i.e. not even studying a course for a bit.
*/
#include<bits/stdc++.h>

using namespace std;
int main(){
int maxtime,numofassigns;
vector < pair< int,int > > assigns;

cout<<"Enter Maximum time Left : "<<endl;
cin>>maxtime;
cout<<"Enter number of assigns : "<<endl;
cin>>numofassigns;
cout<<"Enter time and credits for each course : "<<endl;
for(int i=0;i<numofassigns;++i) {   
int a,b;
cin>>a>>b;
assigns.push_back(make_pair(a,b)); //vector to store time for a particular course and its credits
}


vector <int> ansdp(maxtime + 1,0);
for(auto x:assigns){ //for all courses
for(int i = maxtime - x.first;i>=0;--i){ //for all i in range(maxtime - x.first,0) since maximum time is maxtime
if(i == 0 or ansdp[i] != 0)
ansdp[i+x.first] = max(ansdp[i+x.first],ansdp[i]+x.second); //maximum credits in a particular time
}
}
int maxcredits = 0;
for(int i = maxtime;i>=0;--i){
maxcredits = max(maxcredits,ansdp[i]); //maximum credits you can acquire
}   
cout<<endl<<"Maximum credits you can acquire in time "<<maxtime<<" are : "<<maxcredits<<endl;
return 0;
}

Add a comment
Know the answer?
Add Answer to:
A student has too much work to complete before the deadline is due. Each assignment counts...
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
  • python 3 question Project Description Electronic gradebooks are used by instructors to store grades on individual assignments and to calculate students’ overall grades. Perhaps your instructor uses gr...

    python 3 question Project Description Electronic gradebooks are used by instructors to store grades on individual assignments and to calculate students’ overall grades. Perhaps your instructor uses gradebook software to keep track of your grades. Some instructors like to calculate grades based on what is sometimes called a “total points” system. This is the simplest way to calculate grades. A student’s grade is the sum of the points earned on all assignments divided by the sum of the points available...

  • PYTHON 3 Object Oriented Programming ***a9q3.py file below*** class GradeItem(object): # A Grade Item is anything...

    PYTHON 3 Object Oriented Programming ***a9q3.py file below*** class GradeItem(object): # A Grade Item is anything a course uses in a grading scheme, # like a test or an assignment. It has a score, which is assessed by # an instructor, and a maximum value, set by the instructor, and a weight, # which defines how much the item counts towards a final grade. def __init__(self, weight, scored=None, out_of=None): """ Purpose: Initialize the GradeItem object. Preconditions: :param weight: the weight...

  • Directions: Please complete Prelecture Assignment and upload answers to Carmen as a PDF before coming to...

    Directions: Please complete Prelecture Assignment and upload answers to Carmen as a PDF before coming to lecture. Before attempting this worksheet, please read Lab 8 as this worksheet accompanies the lab and helps you get your lab notebook ready by guiding you through the necessary calculations that will be needed to start the experiment. This lab takes more thought and effort to set-up, but faster to complete if you think about things now. Please bring a copy of the completed...

  • This is a major project so please show all formulas/work on Excel. Thank you so much!...

    This is a major project so please show all formulas/work on Excel. Thank you so much! Instructions Enter your name and Access ID (aa1234' format) in the cells above. The data required for this case will not appear until you do so. You are a financial manager for Zoom Corp., which manufactures bicycles. In the most recent fiscal year, Zoom manufactured and sold 20,000 bicycles. Wheels, seats, and brake calipers are three components of the bicycles currently manufactured by Zoom....

  • Help with a Parallel and Distributed Programming assignment. In this assignment, you will be expl...

    Help with a Parallel and Distributed Programming assignment. In this assignment, you will be exploring different methods of counting the prime numbers between 1 and N. You will use 8 threads, and each will be given a range in which to count primes. The question is: where do you store your counter? Do you use a local variable? Do you use a global variable? Please use the following function to determine whether an integer number is a prime. // Return...

  • Lab Assignment Each student has been assigned a unique data set, and will be required to perform ...

    having trouble working excel, please help Lab Assignment Each student has been assigned a unique data set, and will be required to perform basic statistical analyses on the data. Each exercise should be saved to a new file so one of your first tasks will be to make sufficient copies of your data file, named appropriately. E.g. Grant, Karen Inf Stats Ex1; Grant, Karen Inf Stats Ex2; Grant, Karen Inf Stats Ex3. All data files are taken from real data...

  • Please show work Your group should discuss and solve all problems below. Each student in the...

    Please show work Your group should discuss and solve all problems below. Each student in the group should prepare a neat solution to ONE of the 4 problems (different problems for each group member) Consider the two vectors A and B having directions as shown in the fi 0Al A 61 units) and the magnitude of B is 55 un55 units) 1. gure. The magnitude of A is 61 units ㄩ 52" B68 (a) Write an expression for each vector...

  • IN JAVA PLS DUE TODAY Assignment 4 - Email, Shwitter and Inheritance Select one option from...

    IN JAVA PLS DUE TODAY Assignment 4 - Email, Shwitter and Inheritance Select one option from below. All (both) options are worth the same number of points. The more advanced option(s) are provided for students who find the basic one too easy and want more of a challenge. OPTION A (Basic): Message, EMail and Tweet Understand the Classes and Problem Every message contains some content ("The British are coming! The British are coming!"). We could enhance this by adding other...

  • In Java plz due today Assignment 4 - Email, Shwitter and Inheritance Select one option from...

    In Java plz due today Assignment 4 - Email, Shwitter and Inheritance Select one option from below. All (both) options are worth the same number of points. The more advanced option(s) are provided for students who find the basic one too easy and want more of a challenge. OPTION A (Basic): Message, EMail and Tweet Understand the Classes and Problem Every message contains some content ("The British are coming! The British are coming!"). We could enhance this by adding other...

  • Please to indent and follow structure!!!!! Assignment 3 - The card game: War Due Date: June...

    Please to indent and follow structure!!!!! Assignment 3 - The card game: War Due Date: June 9th, 2018 @ 23:55 Percentage overall grade: 5% Penalties: No late assignments allowed Maximum Marks: 10 Pedagogical Goal: Refresher of Python and hands-on experience with algorithm coding, input validation, exceptions, file reading, Queues, and data structures with encapsulation. The card game War is a card game that is played with a deck of 52 cards. The goal is to be the first player to...

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