The running time analysis of this dynamic programming algorithm can be described as:<br><br>DP table has dimensions (n+1) x 2 x (W1+1) x (W2+1)。<br><br>Filling every entry in the table takes constant time,O(1)。<br><br>Filling the whole DP table takes O(n 2 W1 * W2) time, where n is the number of items, W1 and W2 are the capacities of the two bags. It takes o (n2w1 * w2) time to fill the whole DP table, where n is the number of items and w1 and w2 are the capacities of two packages.
đang được dịch, vui lòng đợi..