diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2013-07-04 00:00:04 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2013-07-04 00:00:04 +0200 |
commit | d80f03f5f99faa93861a3019657db406d7293fa7 (patch) | |
tree | 3c82e8be9abb131f8442d8c3f5c942e37175ad87 | |
parent | c9808b401cd93fa6959dbf6a66df49343979f8ff (diff) | |
download | coursera-d80f03f5f99faa93861a3019657db406d7293fa7.zip coursera-d80f03f5f99faa93861a3019657db406d7293fa7.tar.gz |
Discrete : 01-knapsack: improve debug strings
-rw-r--r-- | 01-knapsack/ks_dp-ng.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/01-knapsack/ks_dp-ng.c b/01-knapsack/ks_dp-ng.c index c2216fc..7830651 100644 --- a/01-knapsack/ks_dp-ng.c +++ b/01-knapsack/ks_dp-ng.c @@ -105,7 +105,7 @@ static void solve(Solver* solver) if (debug > 2) { - printf("\ncurrent V(i,s,W,r)\n"); + printf("\nformat V(i,W)\n"); } /* SOLVE */ @@ -115,7 +115,6 @@ static void solve(Solver* solver) { v = item->v; w = item->w; - data = NULL; data = solver->column + solver->k; up_left = solver->column + (solver->k - w); @@ -139,10 +138,11 @@ static void solve(Solver* solver) if (debug > 2) { + printf("i=%d; j=k; j<=%d:\n", i, lower_bound); data = solver->column; for (j = 0; j <= k; j++, data++) - printf(" % 4d(% 2d % 2d)\n", - data->v, data->i, data->w); + printf(" %d : % 4d(% 2d % 2d)\n", + j, data->v, data->i, data->w); printf("\n"); } } |