question

please convet Algoritm to C++ code

//---------------------------------------------------------------//
int O(int k,int j)
{
if (j==0)
return 0;
else if (w[j]<=k)
return max(O(k,j-1),v[j]+O(k-w[j],j-1));
else
return O(k,j-1);
//---------------------------------------------------------------//
Where exactly is the question?

Also please don't cross-post the same topic within 5 minutes of each other..
http://www.cplusplus.com/forum/beginner/127606/
Last edited on
Topic archived. No new replies allowed.