Skip to content

[FEATURE REQUEST] Backtracking algorithms (All combinations) #3912

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

Closed
TheClerici opened this issue Mar 9, 2023 · 9 comments
Closed

[FEATURE REQUEST] Backtracking algorithms (All combinations) #3912

TheClerici opened this issue Mar 9, 2023 · 9 comments

Comments

@TheClerici
Copy link
Contributor

What would you like to Propose?

I would like to add the all combinations algorithm!

Issue details

Although it is already in another repository from the Algorithms group (Python), I was unable to locate it in the folders (Java).

Additional Information

In this problem, we want to determine all possible combinations of k numbers out of 1 ... n. We use backtracking to solve this problem.

  • Example:

generate_all_combinations(n=4, k=2)
[[1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4]]

@TheClerici
Copy link
Contributor Author

It is a little bit different, as the one you send is the combination in an array, and in this situation is from 1...n

@TheClerici
Copy link
Contributor Author

This is the sister repository with the problem I'm talking about, https://github.com/TheAlgorithms/Python/blob/master/backtracking/all_combinations.py lmk to start it!

@siriak
Copy link
Member

siriak commented Mar 10, 2023

You could just create a function that creates an array with values from 1 to n and calls the already implemented combination function, right? Feel free to do that and I'll review

@TheClerici
Copy link
Contributor Author

Sure, I can do that

debasishbsws pushed a commit that referenced this issue Mar 10, 2023
* ArrayCombination function which uses Combination.java by creating an array of 1 to n

* modified tests
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Apr 10, 2023
@github-actions
Copy link

Please reopen this issue once you add more information and updates here. If this is not the case and you need some help, feel free to seek help from our Gitter or ping one of the reviewers. Thank you for your contributions!

@BamaCharanChhandogi
Copy link
Member

BamaCharanChhandogi commented Apr 17, 2023

Hey @siriak , Please check this PR #4156

@TheClerici
Copy link
Contributor Author

Hello @BamaCharanChhandogi, this PR is already closed as I added a solution for it, I am not a reviewer, I think with that siriak can help out!

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

No branches or pull requests

3 participants