We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如果您实在不想仔细思考,这里有个简单的口诀:0-1 背包对物品的迭代放在外层,里层的体积或价值逆向遍历; 完全背包对物品的迭代放在里层,外层的体积或价值正向遍历。
此处有误。0-1 背包和完全背包对物品的迭代都放在外层。
The text was updated successfully, but these errors were encountered:
感谢关注!
前文有提到
压缩空间时到底需要正向还是逆向遍历呢?物品和体积哪个放在外层,哪个放在内层呢?这取决于状态转移方程的依赖关系。在思考空间压缩前,不妨将状态转移矩阵画出来,方便思考如何进行空间压缩。
另外对于一般的完全背包问题,放在里层外层都是可以的,只要状态转移支持即可,这里仅为一个懒人口诀 :) 下面抛硬币那道题便是内层迭代硬币。
Sorry, something went wrong.
感谢回复!
No branches or pull requests
此处有误。0-1 背包和完全背包对物品的迭代都放在外层。
The text was updated successfully, but these errors were encountered: