Skip to content
New issue

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

Create Unbounded_knapsack.cpp #2786

Merged
merged 28 commits into from
Oct 28, 2024

Conversation

yeolesanskruti
Copy link
Contributor

Description of Change

Issue - #2782

Added Unbounded Knapsack Algorithm in Dp section with algorithm, task and test cases. Also code is verified using gfg ide.

For reference :

Screenshot 2024-10-07 213621

Checklist

  • Added description of change
  • Added file name matches File name guidelines
  • Added tests and example, test must pass
  • Added documentation so that the program is self-explanatory and educational - Doxygen guidelines
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes:
Please review and suggest changes if any @realstealthninja

dynamic_programming/Unbounded_knapsack.cpp Outdated Show resolved Hide resolved
dynamic_programming/Unbounded_knapsack.cpp Outdated Show resolved Hide resolved
dynamic_programming/Unbounded_knapsack.cpp Outdated Show resolved Hide resolved
dynamic_programming/Unbounded_knapsack.cpp Outdated Show resolved Hide resolved
dynamic_programming/Unbounded_knapsack.cpp Outdated Show resolved Hide resolved
dynamic_programming/Unbounded_knapsack.cpp Outdated Show resolved Hide resolved
@realstealthninja realstealthninja added awaiting modification Do not merge until modifications are made Proper Documentation Required requested to write the documentation properly labels Oct 8, 2024
@yeolesanskruti
Copy link
Contributor Author

Sure @realstealthninja I would update the PR soon.
Thank you.

Documentation done.
@yeolesanskruti
Copy link
Contributor Author

I have updated the documentation and code accordingly. Please review @realstealthninja .
Thank you.

dynamic_programming/Unbounded_knapsack.cpp Outdated Show resolved Hide resolved
dynamic_programming/Unbounded_knapsack.cpp Outdated Show resolved Hide resolved
dynamic_programming/Unbounded_knapsack.cpp Outdated Show resolved Hide resolved
dynamic_programming/Unbounded_knapsack.cpp Outdated Show resolved Hide resolved
dynamic_programming/Unbounded_knapsack.cpp Outdated Show resolved Hide resolved
dynamic_programming/Unbounded_knapsack.cpp Outdated Show resolved Hide resolved
dynamic_programming/Unbounded_knapsack.cpp Outdated Show resolved Hide resolved
dynamic_programming/Unbounded_knapsack.cpp Outdated Show resolved Hide resolved
dynamic_programming/Unbounded_knapsack.cpp Outdated Show resolved Hide resolved
dynamic_programming/Unbounded_knapsack.cpp Outdated Show resolved Hide resolved
@yeolesanskruti
Copy link
Contributor Author

@realstealthninja I have updated accordingly. Please review.

@yeolesanskruti
Copy link
Contributor Author

yeolesanskruti commented Oct 9, 2024

@realstealthninja I have updated the file accordingly. Please review.

@yeolesanskruti
Copy link
Contributor Author

@realstealthninja done all changes accordingly.

dynamic_programming/Unbounded_0_1_Knapsack.cpp Outdated Show resolved Hide resolved
dynamic_programming/Unbounded_0_1_Knapsack.cpp Outdated Show resolved Hide resolved
dynamic_programming/Unbounded_0_1_Knapsack.cpp Outdated Show resolved Hide resolved
@yeolesanskruti
Copy link
Contributor Author

@realstealthninja all changes are done accordingly. Hope so code is ready for merge

@yeolesanskruti
Copy link
Contributor Author

@realstealthninja done. Hope that file is ready for the merge now.

@yeolesanskruti
Copy link
Contributor Author

yeolesanskruti commented Oct 13, 2024

@realstealthninja No, in the standard unbounded knapsack problem, the maximum value cannot be negative. The problem is designed to maximize the total value of items placed in the knapsack, and item values are typically non-negative. If all items have zero or negative values, the optimal solution would be to select no items, resulting in a maximum value of 0. Thus, the maximum value is always non-negative.

@realstealthninja
Copy link
Collaborator

@realstealthninja No, in the standard unbounded knapsack problem, the maximum value cannot be negative. The problem is designed to maximize the total value of items placed in the knapsack, and item values are typically non-negative. If all items have zero or negative values, the optimal solution would be to select no items, resulting in a maximum value of 0. Thus, the maximum value is always non-negative.

oh i see! thanks for the clarification

Copy link
Collaborator

@realstealthninja realstealthninja left a comment

Choose a reason for hiding this comment

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

LGTM thanks for this ❤️

@realstealthninja realstealthninja added approved Approved; waiting for merge hacktoberfest-accepted Accepted to be counted towards Hacktoberfest and removed awaiting modification Do not merge until modifications are made Proper Documentation Required requested to write the documentation properly labels Oct 19, 2024
@Pranjal-231003
Copy link

Allow me to work on this , I am kinda late to hacktober so want to complete my PRs

@realstealthninja realstealthninja merged commit db3f9d3 into TheAlgorithms:master Oct 28, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Approved; waiting for merge hacktoberfest-accepted Accepted to be counted towards Hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Unbounded Knapsack in Dynamic Programming Section
3 participants