combinations Questions
7
Solved
I have a list of numbers, e.g.
numbers = [1, 2, 3, 7, 7, 9, 10]
As you can see, numbers may appear more than once in this list.
I need to get all combinations of these numbers that have a given...
Jordison asked 29/12, 2015 at 19:14
3
Solved
I need to generate all combinations of a matrix in Python. The input will be two integers n and m, and I need to generate all possible states of that matrix with 1 and 0 as possible values.
For ex...
Hildie asked 28/2, 2019 at 10:50
4
Solved
I have the following JavaScript object structure:
var options = {
optionOne: [true, false],
optionTwo: [true, false],
optionThree: [
null,
{property1: 9, property2: 7},
{property1: 4, proper...
Hispania asked 29/9, 2015 at 7:41
22
Solved
I need to compute combinatorials (nCr) in Python but cannot find the function to do that in math, numpy or stat libraries. Something like a function of the type:
comb = calculate_combinations(n, r...
Unicef asked 11/6, 2010 at 18:13
5
How can I get all combinations (in order) of length n from a list of numbers? For example, given the list [1, 2, 3, 4], and setting n = 3, how can I get these results?
[1, 2, 3]
[1, 2, 4]
[1, 3, 4]...
Operant asked 15/1, 2015 at 22:24
17
Solved
I have two arrays:
var array1 = ["A", "B", "C"];
var array2 = ["1", "2", "3"];
How can I set another array to contain every combination ...
Keef asked 20/1, 2012 at 4:6
5
Solved
What I need is a reversible function that transforms a long (64-bit integer) into another long number, in a way that seems "random" for a user (but actually is deterministic), so that 3 subsequent ...
Aurea asked 25/12, 2015 at 18:46
11
Solved
I've a vector of vectors say vector<vector<int>> of different sizes as follows:
vector<vector<int>> items = {
{ 1, 2, 3 },
{ 4, 5 },
{ 6, 7, 8 }
};
I want to create comb...
Matron asked 11/3, 2011 at 22:28
16
Solved
I've seen several similar questions about how to generate all possible combinations of elements in an array. But I'm having a very hard time figuring out how to write an algorithm that will only ou...
Hungarian asked 5/4, 2017 at 20:37
14
Solved
What is the most efficient method to evaluate the value of "n choose k" ?
The brute force way I think would be to find n! / k! / (n-k)! by calculating each factorial separately.
A better ...
Brittnee asked 8/3, 2013 at 19:35
4
I need to generate a code (preferably in R) that generates all the equal possibilities of how to divide 9 ranks between 3 independent groups (group sizes are 2, 3, 4). I have tried to come up with ...
Gideon asked 28/11, 2023 at 20:37
4
Solved
I have a table where each row represents the enrollment of one student in one course, similar to this, but much larger:
Student
Course
001
PSYC101
001
CHEM102
002
PSYC101
002
SPAN101
...
Waldack asked 17/10, 2023 at 13:7
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
5
Solved
My question is simple, but I find it difficult to get the point straight, so please allow me to explain step by step.
Suppose I have N items and N corresponding indices.
Each item can be loaded usi...
Manumission asked 30/8, 2023 at 15:58
3
Solved
I have a vector V of consecutive integers of length l , e.g., 1, 2, 3, 4, 5, 6, 7. I want to find all subsets of size k such that the difference between any two numbers in the subset can be no less...
Diva asked 24/8, 2023 at 20:46
14
Solved
I have some code to count permutations and combinations, and I'm trying to make it work better for large numbers.
I've found a better algorithm for permutations that avoids large intermediate resu...
Anecdotal asked 19/1, 2010 at 19:52
6
Solved
Say I have a string list:
li = ['a', 'b', 'c']
I would like to construct a new list such that each entry of the new list is a concatenation of a selection of 3 entries in the original list. Note...
Salema asked 31/8, 2017 at 21:38
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
5
Solved
expand.grid is a very handy function in R for calculating all possible combinations of several list. Here is how it works:
> x = c(1,2,3)
> y = c("a","b")
> z = c(10,12)
> d = expand.g...
Inessive asked 22/2, 2015 at 20:38
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
3
Solved
First of all I'm solving a programming problem rather than a math problem now.
The question is
Anish got an unbiased coin and he tossed it n times and he asked Gourabh to count all the number of p...
Mccleary asked 29/5, 2023 at 13:35
33
Solved
I have a list with 15 numbers. How can I produce all 32,768 combinations of those numbers (i.e., any number of elements, in the original order)?
I thought of looping through the decimal integers 1–...
Turpentine asked 21/1, 2009 at 11:13
5
Solved
I am currently working on this problem as a personal project.
Basically:
Given an array of elements, e.g. E = {1,2,a,b} and
Given a number, K, e.g. K = 2
I want to return all Combinations of E...
Zane asked 2/7, 2015 at 4:16
1
Solved
I have an algorithm that finds the set of all unique sums of the combinations of k tuples drawn with replacement from of a list of tuples. Each tuple contains n positive integers, the order of thes...
Candlepin asked 15/4, 2023 at 7:8
1 Next >
© 2022 - 2024 — McMap. All rights reserved.