Skip to content

Conversation

ritikverma2000
Copy link

I have added fractional knapsack code under greedy. Given the weights and values of n items, we need to put these items in a knapsack of capacity W to get the maximum total value in the knapsack. In Fractional Knapsack, we can break items for maximizing the total value of the knapsack.

Copy link
Collaborator

@ericklarac ericklarac left a comment

Choose a reason for hiding this comment

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

Also add some unit tests

README.md Outdated
@@ -51,7 +51,8 @@ If you want to uninstall algorithms, it is as simple as:
$ pip3 uninstall -y algorithms

## List of Implementations

- [Greedy](algorithms/arrays)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The elements are listed in alphabetical order. Could you add it below dp?

Copy link
Author

Choose a reason for hiding this comment

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

ok no issues I will do it


"""Time Complexity O(n log n)"""
@staticmethod
def getMaxValue(wt, val, capacity):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use snake case

Copy link
Author

Choose a reason for hiding this comment

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

ok

@ritikverma2000
Copy link
Author

Also add some unit tests

what do you mean by some unit test cases?

I have added the greedy below the Dp as you requested.
I have made the necessary changes as requested for the snake case in my code.
@ericklarac
Copy link
Collaborator

Also add some unit tests

what do you mean by some unit test cases?

To add test cases under the test folder, check this PR as guide

@ritikverma2000
Copy link
Author

Also add some unit tests

what do you mean by some unit test cases?

To add test cases under the test folder, check this PR as guide

I am new to open-source I don't know how to proceed with the test folder.

Copy link
Collaborator

@ericklarac ericklarac left a comment

Choose a reason for hiding this comment

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

Also add some unit tests

what do you mean by some unit test cases?

To add test cases under the test folder, check this PR as guide

I am new to open-source I don't know how to proceed with the test folder.

Refer to python unittest, this is to add some test cases for your code/functions.


"""Time Complexity O(n log n)"""
@staticmethod
def get_Max_Value(wt, val, capacity):
Copy link
Collaborator

Choose a reason for hiding this comment

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

change to snake case with lower case get_Max_Value -> get_max_value

Copy link
Author

Choose a reason for hiding this comment

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

ok

@ritikverma2000
Copy link
Author

Also add some unit tests

what do you mean by some unit test cases?

To add test cases under the test folder, check this PR as guide

I am new to open-source I don't know how to proceed with the test folder.

Refer to python unittest, this is to add some test cases for your code/functions.

I have made all necessary changes as asked by you pls allow me to merge my pull request.

@ritikverma2000
Copy link
Author

Also add some unit tests

@ritikverma2000
Copy link
Author

Pls add hacktoberfest label also to this pull request

@ritikverma2000
Copy link
Author

pls allow me to merge

@ritikverma2000
Copy link
Author

thanks for merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants