Top "Combinatorics" questions

Deals with combinations of entities belonging to a finite set in accordance with certain constraints.

Set partitions in Python

I have an array of [1,2,3] I want to make all the possible combinations using all elements of the array: Result: [[1], [2], [3]] [[1,2], [3]] [[1], [2,3]] [[1,3], [2]] [[1,2,3]]

python arrays combinatorics
Cartesian product of a dictionary of lists

I'm trying to write some code to test out the Cartesian product of a bunch of input parameters. I've looked …

python generator combinatorics
Number of n-element permutations with exactly k inversions

I am trying to efficiently solve SPOJ Problem 64: Permutations. Let A = [a1,a2,...,an] be a permutation of integers 1,2,...,n. …

algorithm permutation dynamic-programming combinatorics discrete-mathematics
List all possible combinations of k integers between 1...n (n choose k)

Out of no particular reason I decided to look for an algorithm that produces all possible choices of k integers …

c# algorithm math combinatorics
Number of substrings in a string: n-squared or exponential

How many subtrings are there in a string in general? Why does string x [1:n] have O(n^2) subtrings according …

algorithm dynamic-programming combinatorics
Algorithm to determine coin combinations

I was recently faced with a prompt for a programming algorithm that I had no idea what to do for. …

c++ algorithm combinations combinatorics
Get all pairwise combinations from a list

For example, if the input list is [1, 2, 3, 4] I want the output to be [[1,2], [1,3], [1,4], [2,3], [2,4], [3,4]] If possible, I would like a solution …

python list combinatorics
permutations/combinatorics library for java?

I am looking for a library for java that will generate all possible order permutations of a set. The only …

java permutation combinatorics
Generating all 5 card poker hands

This problem sounds simple at first glance, but turns out to be a lot more complicated than it seems. It's …

python algorithm permutation combinatorics poker
Calculate the number of ways to roll a certain number

I'm a high school Computer Science student, and today I was given a problem to: Program Description: There is a …

java algorithm probability combinatorics