()
| 198 | |
| 199 | |
| 200 | def main(): |
| 201 | prices = [6, 10, 12, 15, 20, 23] |
| 202 | n = len(prices) |
| 203 | |
| 204 | # the best revenue comes from cutting the rod into 6 pieces, each |
| 205 | # of length 1 resulting in a revenue of 6 * 6 = 36. |
| 206 | expected_max_revenue = 36 |
| 207 | |
| 208 | max_rev_top_down = top_down_cut_rod(n, prices) |
| 209 | max_rev_bottom_up = bottom_up_cut_rod(n, prices) |
| 210 | max_rev_naive = naive_cut_rod_recursive(n, prices) |
| 211 | |
| 212 | assert expected_max_revenue == max_rev_top_down |
| 213 | assert max_rev_top_down == max_rev_bottom_up |
| 214 | assert max_rev_bottom_up == max_rev_naive |
| 215 | |
| 216 | |
| 217 | if __name__ == "__main__": |
no test coverage detected