Skip to content

ENH: Added a functionality to make it possible to reconstruct an optimal subset for the dynamic programming problem - #1139

Merged
cclauss merged 6 commits into
TheAlgorithms:masterfrom
maxwell-aladago:knapsack_example_sol
Aug 19, 2019
Merged

ENH: Added a functionality to make it possible to reconstruct an optimal subset for the dynamic programming problem#1139
cclauss merged 6 commits into
TheAlgorithms:masterfrom
maxwell-aladago:knapsack_example_sol

Conversation

@maxwell-aladago

Copy link
Copy Markdown
Contributor

Also reformatted parts of the original file.

@cclauss cclauss left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove legacy Python imports and add Python type hints.

Comment thread dynamic_programming/knapsack.py Outdated

Note that only the integer weights 0-1 knapsack problem is solvable using dynamic programming.
"""
from __future__ import print_function, division, absolute_import

@cclauss cclauss Aug 18, 2019

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This repo does not support legacy Python so these directives are not needed.

Comment thread dynamic_programming/knapsack.py Outdated
Comment thread dynamic_programming/knapsack.py Outdated
Comment thread dynamic_programming/knapsack.py Outdated
@cclauss cclauss self-assigned this Aug 18, 2019

@cclauss cclauss left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work! Thanks! Please wrap line 2 so the file can be read on GitHub without left-right scrolling.

@cclauss
cclauss merged commit 5d46a4d into TheAlgorithms:master Aug 19, 2019
stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
…mal subset for the dynamic programming problem (TheAlgorithms#1139)

* function for the knapsack problem which returns one of the optimal subsets

* function for the knapsack problem which returns one of the optimal subsets

* function for the knapsack problem which returns one of the optimal subsets

* function for the knapsack problem which returns one of the optimal subsets

* function for the knapsack problem which returns one of the optimal subsets

* some pep8 cleanup too
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants