combinatorics Questions
1
I'm trying to optimize an algorithm that counts permutations with specific constraints. Given integers n, t, a, b where:
n is the length of permutation (1 to n)
t is the required number of fixed p...
Erhard asked 31/10 at 12:15
0
Problem set
This is somewhat a generalization of the famous partition of integer n into k parts.
Given two integers a,b I need to find the number of partitions into k distinct parts that sum ...
Outport asked 2/6 at 14:22
7
Solved
Problem
I have a group of people, and I want each person to have a 1:1 meeting with every other person in the group. A given person can only meet with one other person at a time, so I want to do t...
Loquacious asked 1/7, 2018 at 4:28
6
Solved
I am trying to generate a list of all combinations numbers that satisfy all the following conditions:
Any combination is exactly 6 numbers long
The possible numbers are only 1,5,7
1 can only be fo...
Annapolis asked 1/5 at 3:42
2
Solved
I am facing a unique situation where I have 31 students in my class and I want them to be divided into 8 groups (4 each with exception of one with only 3 members). The specific rule I am trying to ...
Nadinenadir asked 29/1 at 23:18
16
Solved
I wish to produce the Cartesian product of 2 lists in Haskell, but I cannot work out how to do it. The cartesian product gives all combinations of the list elements:
xs = [1,2,3]
ys = [4,5,6]
car...
Scottie asked 7/11, 2010 at 21:13
3
Solved
I think this is a common combinatorics problem, but I can't seem to find a name for it or any material about it. I am doing this in Python and numpy, but if there is a fast matrix method for this, ...
Furrier asked 19/7, 2011 at 16:3
7
Solved
I need a way of calculating combinations without running out of memory. Here's what i have so far.
public static long combination(long n, long k) // nCk
{
return (divideFactorials(factorial(n), (...
Cann asked 19/10, 2012 at 23:24
5
Solved
I would like to generate all the possible combinations of the elements of a given number of vectors.
For example, for [1 2], [1 2] and [4 5] I want to generate the elements:
[1 1 4; 1 1 5; 1 2 4;...
Hitt asked 12/11, 2010 at 14:56
3
Solved
Let's say I have an N-side dice with non-uniform probabilities for each side and I throw it M times. Now instead of observing the individual outcomes, we only observe the sum.
I have to code the li...
Tubercle asked 15/9, 2023 at 23:36
41
Solved
How do I generate all the permutations of a list? For example:
permutations([])
[]
permutations([1])
[1]
permutations([1, 2])
[1, 2]
[2, 1]
permutations([1, 2, 3])
[1, 2, 3]
[1, 3, 2]
[2, 1, 3]
...
Jump asked 19/9, 2008 at 18:41
3
I am looking for some ideas on how to tackle the following problem. My primary language is R.
Description
I have a set S and a collection of valid subsets U. I am looking to find all exact covers o...
Chose asked 21/12, 2022 at 23:51
9
I want to create a list for my classroom of every possible group of 4 students. If I have 20 students, how I can I create this, by group, in R where my rows are each combination and there are 20 co...
Caban asked 30/8, 2019 at 20:5
7
How to perform iteration over excel/google sheets cells to get pairwise combinations?
"string1"
"string2"
"string3"
...
"string10"
I'm looking at writing a function that can iterate over these ...
Popular asked 21/12, 2017 at 9:54
2
Solved
TL;DR: I am looking for a more generalized solution for a combination problem which I partly solved with my not so good coding skills.
Brief Description
Imagine you have a dataset with some measure...
Backcourt asked 26/7, 2023 at 14:48
4
The current post is a follow-up question to this linked one:
Shuffle a deck of 7 hypothetical trading cards and list out the orders they can come in a Google Sheet
Surprise! My problem child is act...
Enthusiast asked 17/9, 2022 at 4:27
8
Solved
Given a PHP array of strings, e.g.:
['peter', 'paul', 'mary']
How to generate all possible permutations of elements of this array? i.e.:
peter-paul-mary
peter-mary-paul
paul-peter-mary
paul-ma...
Sycosis asked 19/4, 2012 at 6:37
3
Solved
While writing a program that finds all the different combos for a list, I found a lot of threads about using intertools.product() instead of intertools.combinations_with_replacement(), as I have be...
Amour asked 20/1, 2014 at 0:51
7
Is there a Haskell function that generates all the unique combinations of a given length from a list?
Source = [1,2,3]
uniqueCombos 2 Source = [[1,2],[1,3],[2,3]]
I tried looking in Hoogle but ...
Solfeggio asked 2/10, 2018 at 5:26
34
I just tried for my first programming interview and one of the questions was to write a program that given a 7 digit telephone number, could print all possible combinations of letters that each num...
Snowcap asked 26/2, 2010 at 20:10
3
Solved
I am reading about programming, and one exercise involved programming Pascal's triangle in R. My first idea was to make a list and then append things to it, but that didn't work too well. Then I th...
Wayless asked 13/4, 2010 at 19:8
3
Feels like this should be straightforward but I have been through stack overflow and combn help, and cannot see solution.
The below players need to be in teams of 3 versus 2. I need to find all pos...
Filmy asked 20/4, 2023 at 13:20
11
Solved
Cheers,
I know you can get the amount of combinations with the following formula (without repetition and order is not important):
// Choose r from n
n! / r!(n - r)!
However, I don't know how to...
Urgency asked 3/12, 2009 at 8:3
1
Solved
I am rewriting a python program into rust and I am struggling to translate this line:
itertools.product(range(0,8), repeat=n)
What I am trying to achieve is something like this: https://pastebin.co...
Antiworld asked 24/3, 2023 at 13:35
3
Solved
Over the holidays, I was gifted a game called "Kanoodle Extreme". The details of the game are somewhat important, but I think I've managed to abstract them away. The 2D variant of the gam...
Salesmanship asked 2/1, 2023 at 2:59
1 Next >
© 2022 - 2024 — McMap. All rights reserved.