-
-
Notifications
You must be signed in to change notification settings - Fork 46.8k
Create-Add files to greedy_method directory #2082
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
Conversation
How is this faster or better than https://github.com/TheAlgorithms/Python/search?q=knapsack ? https://docs.pytest.org/en/latest/goodpractices.html#conventions-for-python-test-discovery |
I am not a fan of creating a new directory here. What do other maintainers think given the other implementations. |
Its faster in terms of Time Complexiity. Greedy methods are generally faster. For example, Dijkstra's shortest path algorithm takes O(ELogV + VLogV) time. Dynamic Programming is generally slower. For example, Bellman Ford algorithm takes O(VE) time. I will change the filename. Thank you @cclauss 👍 |
Well! Greedy Algo is not the same as Dynamic Programming, so I created a different directory for the same. You may tell me, if these files need to be shifted in an existing directory. 💯 |
Can we please have a benchmark that proves that this implementation is faster than all other knapsack implementations in this repo. |
Yeah sure! Greedy Algorithm is not the best but in some cases, it is! Refer https://www.geeksforgeeks.org/greedy-approach-vs-dynamic-programming/ for a detailed explanation! :) |
Hey @Apoorve73, TravisBuddy Request Identifier: 40244f00-a984-11ea-9161-4f77e253115e |
Hey @Apoorve73, TravisBuddy Request Identifier: 0efc7af0-a98a-11ea-9161-4f77e253115e |
Thank you @cclauss for all the valuable suggestions. I will fix them soon! |
Hey @Apoorve73, TravisCI finished with status TravisBuddy Request Identifier: aad44860-aa3c-11ea-9064-4d6590cbb359 |
Hey @Apoorve73, TravisBuddy Request Identifier: f62a3670-aa3d-11ea-9064-4d6590cbb359 |
@cclauss kindly review the changes! |
Hey @Apoorve73, TravisBuddy Request Identifier: 108975c0-aa49-11ea-9064-4d6590cbb359 |
Hey @Apoorve73, TravisBuddy Request Identifier: 6974d6d0-aa4d-11ea-9064-4d6590cbb359 |
Travis tests have failedHey @Apoorve73, TravisBuddy Request Identifier: 21488530-aa5e-11ea-9064-4d6590cbb359 |
Hey @Apoorve73, TravisCI finished with status TravisBuddy Request Identifier: 8a8dad90-aa5e-11ea-9064-4d6590cbb359 |
Thank you @cclauss and @mateuszz0000 for assisting me. I have tried my best to fix all the issues and improve code quality. Kindly review it, so as to get my PR merged or to suggest any further changes. |
Travis tests have failedHey @Apoorve73, TravisBuddy Request Identifier: c86ff260-aa65-11ea-9064-4d6590cbb359 |
Travis tests have failedHey @Apoorve73, TravisBuddy Request Identifier: d7185170-aa67-11ea-9064-4d6590cbb359 |
Hey @Apoorve73, TravisBuddy Request Identifier: 41b345d0-aa68-11ea-9064-4d6590cbb359 |
@cclauss , are there any more changes to be performed? :) |
Thanks once again! 👍 |
* Add Greedy Method Approach * Update Filename * Update Variable and Links * Fixed flake8 bugs * Update unittest filename * Update unittest filename * Final unittest filename update * Pythonic Code formatting * flake8 fixes * lowercase function name * Add zip function * Add zip function * params lowercase * Travis CI fixes * Update and rename knapsack_problem.py to knapsack.py * Update test_knapsack.py * Fix bugs * Rename knapsack.py to greedy_knapsack.py * Update test_knapsack.py Co-authored-by: Christian Clauss <cclauss@me.com>
Greedy Method approach is one of the method to solve Optimisation Problems and is widely used.
The file greedy_knapsack.py is an example problem to show the working of greedy approach, along with a test_knapsack file.
Checklist:
Fixes: #{$ISSUE_NO}
.