Q3: Suppose you have one machine and a set of n jobs a1, a2, ..., an to process on that machine. Each job aj has a processing time tj, a profit pj and a deadline dj. The machine can process only one job at a time, and job aj must run uninterruptedly for tj consecutive time units. If job aj is completed by its deadline dj, you receive a profit pj, but if it is completed after its deadline, you receive a profit of 0. Give a DP algorithm to find the schedule that obtains the maximum amount of profit.
Assuming that the processing times and deadlines are integers between 1 to n, the running time of your algorithm should be polynomial in terms of n. What is the running time of your algorithm?