Seven Hundred Sixty Megabytes

0/1 knapsack with n=2000n = 2000 items and capacity W=100000W = 100000. Values fit in a 32-bit int. The memory limit is 256 MB.

Compare int f[n+1][W+1] against the rolled int f[W+1]. What are the two footprints?

A

About 1.5 GiB and about 391 KiB. Only the rolled version fits.

B

About 763 MiB and about 391 KiB. Only the rolled version fits.

C

About 191 MiB and about 391 KiB. Both fit, so there is no reason to roll the table.

D

About 763 MiB and about 782 KiB. The rolled version needs two rows to stay correct.