Questions tagged [permutation]

A permutation is an arrangement of objects into a particular order.

A permutation is an arrangement of objects into a particular order.

For example, permutations of a set such as {1,2,3} are (1,2,3), (1,3,2), (2,1,3), (2,3,1), (3,1,2), and (3,2,1). The number of permutation of n objects is n! = n*(n-1)*(n-2)*...*3*2*1

References

5231 questions
2
votes
0 answers

Java generating all possible string combinations

I´m looking for a algorithm which returns me a list of all possible combinations of x-characters and a defined length. For example when I have the characters a and b and the length two I would like to get this output: a b aa ab ba bb But I also…
Ka Rl
  • 517
  • 8
  • 15
2
votes
3 answers

.NET - Calculating combinations with additional rules and twists

UPDATE: @bphelpsjr answer provides what I am looking for. Unfortunately someone down-voted him and I do not have the rep to up-vote. I am marking his response as the answer. This is extremely long winded but I wanted to provide as much detail as…
Dotarp
  • 88
  • 5
2
votes
1 answer

Compare Numpy and Matlab code that uses random permutation

I'm having problems to compare the output of two code because of random number state. I'm comparing the MATLAB randperm function with the output of the equivalent numpy.random.permutation function but, even if I've set the seed to the same value…
linello
  • 8,451
  • 18
  • 63
  • 109
2
votes
3 answers

Execute ruby statements which are located inside an array

I was wondering if it is possible to save some ruby statements inside an Array like: a = 1 b = 0 statements = ['a += 1','b = a + 4'] statements.each { |s| s.execute } The reason for why I want to do this is to be able to use Array…
user3207230
  • 587
  • 7
  • 16
2
votes
4 answers

Reorder random columns between blocked rows in a data frame in R

I would like to randomly reorder each column separately between given blocks of rows of a data frame. The row blocks are consecutive as…
user1830307
2
votes
5 answers

How can I generate all permutations / combinations of multiple arrays?

My goal is simple, I am trying to generate a list of all possible combinations for a product in a database. So for example; the product options are as follows Product Option: Color / Values: Red, Green, Blue Product Option: Size/ Values: Small,…
Joe Raio
  • 1,795
  • 1
  • 12
  • 17
2
votes
1 answer

Excel VBA script to Compare Two Sets of Data and ID Permutations

I'm putting together a VBA script that compares two columns of data (about 15,000 rows each) and determines if any cell is a permutation/ of another cell. For example, if A1 = 15091 and B52 = 19510 then the function would identify them as having…
2
votes
2 answers

Permuting n elements by swapping each element by no more than k positions

What I have is a vector (n = 4 in the example): x = '0123'; What I want is a vector y of the same size of x and with the same elements as in x in different order: y = ['0123'; '0132'; '0213'; '0231'; '0312'; '0321'; '1023'; '1032'; '1203'; '1302';…
randomatlabuser
  • 626
  • 4
  • 13
2
votes
1 answer

Permutations with repetitions

Is there any inbuilt function in Julia language that permutes a given list with repetitions There are n^n such permutations for a list of n elements
hanugm
  • 1,127
  • 3
  • 13
  • 44
2
votes
2 answers

vb .net permutation of string. permutation or combination?

i've got arary of string like this C - F - A - M. i want to create a combination from that with condition: each other item beside last character has to be combined with last character there's not allowed a same combination, even the order is…
Soni Gunz
  • 135
  • 5
  • 17
2
votes
1 answer

writing a loop that ends when every permutation has been tried

I have a function which takes six octal (0-7) digits as an argument and returns true or false. I would like to run a loop that tries every single permutation of the values 0-7, and counts the number of "true" returns. something like: function…
ridthyself
  • 821
  • 1
  • 8
  • 19
2
votes
2 answers

lists permutation in python

I have the following lists: list1 = [ 'A','B','C'] list2 = [ '1', '2' ] Trying to generate a new list of tuples with the following desired result: [(A1),(A2),(A1,B1),(A1,B2),(A2,B1),(A2,B2),(A1,B1,C1),(A2,B1,C1)...] Each tuple will eventully be…
idanshmu
  • 5,061
  • 6
  • 46
  • 92
2
votes
0 answers

Generating all permutations of numbers in ascending order of javascript

Here is my code : Permutation Generator