خرید بک لینک

Vote count: -1

the code below has two parameters "int price[ ] "and "n", how to change the code to have only one parameter "int price[ ]" and make it works?

// // A Naive recursive solution for Rod cutting problem
class RodCutting
{
/* Returns the best obtainable price for a rod of length
   n and price[] as prices of different pieces */
static int cutRod(int price[], int n)
{
    if (n <= 0)
        return 0;
    int max_val = Integer.MIN_VALUE;

    // Recursively cut the rod in different pieces and
    // compare different configurations
    for (int i = 0; i

reference: http://www.geeksforgeeks.org/dynamic-programming-set-13-cutting-a-rod/

asked 44 secs ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 21 فروردين 1396 ساعت: 6:41

صفحه بندی