Content deleted Content added
→Weighted: added citation |
→Weighted: fixed code |
||
Line 47:
int p[numOfVectors+1]; //p[j] is the # of vectors that end before v[j] begins.
int M[numOfVectors+1];
int finalSchedule[
//v[0] does not exist. The first interval vector is set to v[1].
Line 56:
}
//The maximum weight of the schedule is equal to M[numOfVectors+1].
schedule(j){
if(j==0){return;}
else if(w[j]+M[p[j]] >= M[j-1]){
prepend(v[j], finalSchedule); //
schedule(p[j]);
} else {schedule(j-1);}
|