I'm trying to write pseudocode for the Activity Selection Problem in dynamic programming as opposed to Greedy Algorithm. The recurrence I have is:
c[i,j] = max(c[i,k] + c[k,j] + 1), where c[i,j] denotes the size of an optimal solution for set of activities.
So far, I have:
ACTIVITY-DYNAMIC(s, f)
n = length(s)
c = []
for i to n
c[i] = max(c[i,k] + c[k,j] + 1)
But I can't seem to figure out what to do next. Any suggestions, pointers?
kin this case? Also, would I fillc[0,i]andc[i,0]with zeros? – Darksky Feb 19 at 15:18