mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-14 03:22:23 +08:00
Bug fixes and improvements (#1380)
* preorder, inorder, postorder -> pre-order, in-order, post-order * Bug fixes * Bug fixes * Update what_is_dsa.md * Sync zh and zh-hant versions * Sync zh and zh-hant versions. * Update performance_evaluation.md and time_complexity.md * Add @khoaxuantu to the landing page. * Sync zh and zh-hant versions * Add @ khoaxuantu to the landing page of zh-hant and en versions.
This commit is contained in:
@ -29,7 +29,7 @@ function unboundedKnapsackDP(wgt, val, cap) {
|
||||
return dp[n][cap];
|
||||
}
|
||||
|
||||
/* 完全背包:狀態壓縮後的動態規劃 */
|
||||
/* 完全背包:空間最佳化後的動態規劃 */
|
||||
function unboundedKnapsackDPComp(wgt, val, cap) {
|
||||
const n = wgt.length;
|
||||
// 初始化 dp 表
|
||||
@ -58,6 +58,6 @@ const cap = 4;
|
||||
let res = unboundedKnapsackDP(wgt, val, cap);
|
||||
console.log(`不超過背包容量的最大物品價值為 ${res}`);
|
||||
|
||||
// 狀態壓縮後的動態規劃
|
||||
// 空間最佳化後的動態規劃
|
||||
res = unboundedKnapsackDPComp(wgt, val, cap);
|
||||
console.log(`不超過背包容量的最大物品價值為 ${res}`);
|
||||
|
Reference in New Issue
Block a user