Is there an algorithm that, given a set (1,2,3,4,5,...), gives it's n-th permutation in lexicographical order, without needing to compute all permutations before it? I.e, if I want the 6th permutation, it would give me (1,3,2,4,5) directly, without the need to compute:
(1,2,3,5,4)
(1,2,4,3,5)
(1,2 ...
Search found 5 matches
- Thu Apr 13, 2006 10:21 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11023 - Multisets and Sequences
- Replies: 10
- Views: 4864
- Thu Apr 13, 2006 4:09 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11021 - Tribles
- Replies: 15
- Views: 7100
- Thu Apr 13, 2006 5:11 am
- Forum: Volume 110 (11000-11099)
- Topic: 11021 - Tribles
- Replies: 15
- Views: 7100
Precision
I think I'm getting W.A.'s because of floating point precision, although I'm using long doubles all around, and pow() instead of multiplications =(
Can someone check my implementation, please?
Can someone check my implementation, please?
- Tue Apr 04, 2006 5:34 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11018 - Mars Buggy
- Replies: 6
- Views: 3877
- Tue Apr 04, 2006 8:44 am
- Forum: Volume 110 (11000-11099)
- Topic: 11018 - Mars Buggy
- Replies: 6
- Views: 3877
Testing
I'm getting WA's, can anyone check it the following input/output pair is correct?
input:
100
aa -0.189153 2.263902
ab -0.502504 3.446408
ac -0.583654 1.644747
ad -0.423869 3.753228
ae -0.335398 0.309623
af 0.287535 3.588060
ag -1.194601 4.403616
ah -1.451011 6.046235
ai -0.130068 4.715645
aj 1 ...
input:
100
aa -0.189153 2.263902
ab -0.502504 3.446408
ac -0.583654 1.644747
ad -0.423869 3.753228
ae -0.335398 0.309623
af 0.287535 3.588060
ag -1.194601 4.403616
ah -1.451011 6.046235
ai -0.130068 4.715645
aj 1 ...