Finding even permutations using Haskell

I tried to figure out how to find the even permutations out of the set {permutations [1..n]}. I have asked this question before on a different forum, and got an answer that worked namely the code was: Import Data.List -- number of inversions in a p...
more »

2017-07-07 20:07 (1) Answers

Pandas: Pairwise concatenation of column vectors

I'm working with a frame like df = pd.DataFrame({ 'G1':[1.00,0.69,0.23,0.22,0.62], 'G2':[0.03,0.41,0.74,0.35,0.62], 'G3':[0.05,0.40,0.15,0.32,0.19], 'G4':[0.30,0.20,0.51,0.70,0.67], 'G5':[0.40,0.36,0.88,0.10,0.19] }) and I want to manipulate it so...
more »

2017-03-07 04:03 (2) Answers

Provably correct permutation in less than O(n^2)

Written in Haskell, here is the data type that proves that one list is a permutation of another: data Belongs (x :: k) (ys :: [k]) (zs :: [k]) where BelongsHere :: Belongs x xs (x ': xs) BelongsThere :: Belongs x xs xys -> Belongs x (y ': xs)...
more »

2017-03-05 00:03 (0) Answers

Algorithm to create subgroups of people

we are looking for an algorithm that could help us creating subgroups of people. I'll explain it better with an example: We have a group of 5 students, let's call them A, B, C, D, E. Given a number (call it n) smaller than the number of students (&l...
more »

2017-02-21 07:02 (1) Answers

C Multiple arrays permutations algorithm

I'm trying to write a program that generates permutations upon a list of words stored into several arrays. For example, my program asks for 2 groups of words like this : words #1: abc def ghi words #2: 123 456 What i'm trying to have is this outp...
more »

2017-01-13 11:01 (1) Answers