in reply to Re: Odometer pattern iterator (in C). (Updated.)
in thread Odometer pattern iterator (in C). (Updated.)
I know you won't like me saying this,
I have no problem with you saying it; though I somewhat fear what the consequence might be given previous examples.
this comment: “give me all 3-tuples in the domain 0..5 such that none of the values in the tuple are duplicated.” ... is actually interesting
So, the question is, where did he steal it from?
and the idea of using a recursive function also makes some sense (although, to tell the truth, I fail to see the relevance of ... the eight-queens problem
Exactly. None.
directly searching for all unique N-tuples in a set of M unique elements, I came up with this
You came up with a solution.
His posts are like those "Your Stars" astrology pieces in newspapers; so vague that you can read just about anything into them.
But your solution bears no resemblance to the "pseudo-code" he posted; and that bears no resemblance to any language I know; nor anything vaguely workable.
Computing almost 1.7m solutions in just over half a second is not too bad, it seems to me, but I have no idea on the dimensions of the actual problem you are trying to solve. This solution can easily be ported to C, I think, if performance needs to be higher.
Three thoughts:
(That's why compilers attempt to convert recursion to iteration.)
It's relatively easy to do in Perl; you just write it to take a callback (code block), but much harder to do in C.
Does it find all 601 million solutions? Does it come close to doing so in 5s?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Odometer pattern iterator (in C). (Updated.)
by Laurent_R (Canon) on Jun 01, 2015 at 08:59 UTC |