-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Add knapsack exercise #377
Conversation
Naming and arguments are taken from the Scheme track. |
config.json
Outdated
"uuid": "41029de7-58a6-431b-9f82-6d4603604fb3", | ||
"practices": [], | ||
"prerequisites": [], | ||
"difficulty": 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the difficulty should be bumped. Racket marks this an easy exercise (3), Common Lisp as medium (7) and Scheme as hard (8).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected.
|
||
(require 'cl-lib) | ||
|
||
(defun knapsack (capacity weights values) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did the exercise generator use knapsack
for the function name? Looking at problem specifications, It should be maximum-value
.
Also, the current argument list clashes with the instructions. The docs indicate the items should be a sequence of items with both weight and value stored together. I'd recommend taking a look at the Common Lisp implementation of this exercise.
I'd prefer the function to also be named maximumValue as indicated in problem-specificatins
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had changed the name and argument list to follow the Scheme track.
Now updated to follow problem specifications / Common Lisp.
No description provided.