Top "Combinatorics" questions

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

Generate all permutations of a list without adjacent equal elements

When we sort a list, like a = [1,2,3,3,2,2,1] sorted(a) => [1, 1, 2, 2, 2, 3, 3] equal elements are always adjacent in the resulting list. How …

python algorithm combinatorics
The Assignment Problem, a NumPy function?

Since an assignment problem can be posed in the form of a single matrix, I am wondering if NumPy has …

python numpy optimization scipy combinatorics
Generating all combinations with repetition using MATLAB

How do I create all k-combinations with repetitions of a given set (also called k-multicombinations or multisubsets) using MATLAB? This …

matlab combinations combinatorics multiset
Finding all the unique permutations of a string without generating duplicates

Finding all the permutations of a string is by a well known Steinhaus–Johnson–Trotter algorithm. But if the string …

c algorithm combinatorics
N-D version of itertools.combinations in numpy

I would like to implement itertools.combinations for numpy. Based on this discussion, I have a function that works for 1…

python numpy combinatorics itertools
How to calculate the index (lexicographical order) when the combination is given

I know that there is an algorithm that permits, given a combination of number (no repetitions, no order), calculates the …

algorithm performance math combinatorics
What does this list permutations implementation in Haskell exactly do?

I am studying the code in the Data.List module and can't exactly wrap my head around this implementation of …

list haskell permutation combinatorics
How to generate all the permutations of a multiset?

A multi-set is a set in which all the elements may not be unique.How to enumerate all the possible …

string algorithm combinations combinatorics backtracking
All permutations with repetition using scala

I am looking for the scala way to give all permutations without repetitions. I know there are some postings on …

scala combinations combinatorics repeat
Variable amount of nested for loops

Edit: I'm sorry, but I forgot to mention that I'll need the values of the counter variables. So making one …

javascript nested-loops combinatorics