Re: [Haskell-cafe] Parity of the number of inversions of a permutation

2005-03-15 Thread Henning Thielemann
On Tue, 15 Mar 2005, Ben Rudiak-Gould wrote: Henning Thielemann wrote: I' searching for a function which sorts the numbers and determines the parity of the number of inversions. I assume that there are elegant and fast algorithms for this problem (n * log n time steps), e.g. a merge sort algorit

Re: [Haskell-cafe] Parity of the number of inversions of a permutation

2005-03-15 Thread Ben Rudiak-Gould
Henning Thielemann wrote: I' searching for a function which sorts the numbers and determines the parity of the number of inversions. I assume that there are elegant and fast algorithms for this problem (n * log n time steps), e.g. a merge sort algorithm. This is a rather nice little problem. I t

Re: [Haskell-cafe] Parity of the number of inversions of a permutation

2005-03-12 Thread Henning Thielemann
On Fri, 11 Mar 2005, William Lee Irwin III wrote: On Wed, Mar 09, 2005 at 12:42:09PM +0100, Henning Thielemann wrote: I'm searching for a function which sorts the numbers and determines the parity of the number of inversions. I assume that there are elegant and fast algorithms for this problem (n

Re: [Haskell-cafe] Parity of the number of inversions of a permutation

2005-03-11 Thread William Lee Irwin III
On Wed, Mar 09, 2005 at 12:42:09PM +0100, Henning Thielemann wrote: > I think it is a quite popular problem. I have a permutation and I want to > count how often a big number is left from a smaller one. More precisely > I'm interested in whether this number is even or odd. That's for instance >

[Haskell-cafe] Parity of the number of inversions of a permutation

2005-03-09 Thread Henning Thielemann
I think it is a quite popular problem. I have a permutation and I want to count how often a big number is left from a smaller one. More precisely I'm interested in whether this number is even or odd. That's for instance the criterion to decide whether Lloyd's shuffle puzzle is solvable or not.