Update AllCombinationsOfSizeK.js#1530
Merged
raklaptudirm merged 8 commits intoTheAlgorithms:masterfrom Oct 30, 2023
Merged
Conversation
appgurueu
requested changes
Oct 17, 2023
Collaborator
appgurueu
left a comment
There was a problem hiding this comment.
Looks good, however formatting seems broken. If you're already refactoring this, could you get rid of the class entirely? This should be a single function taking n and k as parameters instead. Ideally the API should also be a generator rather than producing a list.
appgurueu
approved these changes
Oct 23, 2023
appgurueu
requested changes
Oct 23, 2023
Collaborator
appgurueu
left a comment
There was a problem hiding this comment.
You'll need to fix the tests, though. They currently still expect a class.
Changes made it the type of testing. Instead of testing the class now the program will test the function
Contributor
Author
|
I am not able to get that why there is code style error in this pull request |
appgurueu
approved these changes
Oct 29, 2023
raklaptudirm
approved these changes
Oct 30, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your change:
This PR modifies a current algorithm for AllCombinationsOfSizeK. Four parameters made up the original findCombinations() method, and they were duplicated for each stack call. Since the modifications are kept in the instance variables, the modified findCombinations() method does not require any parameters. In this case, there will be far fewer local variables that need to be initialized overall on each recursive call.
There was also a for loop in the original technique. The updates function is entirely recursive and lacks a for loop.
Checklist:
Example:
UserProfile.jsis allowed butuserprofile.js,Userprofile.js,user-Profile.js,userProfile.jsare notFixes: #{$ISSUE_NO}.