Velocity Reviews > permutations II

# permutations II

Eric Sosman
Guest
Posts: n/a

 04-28-2009
BartC wrote:
>
> In the real world letter case usually has no significance.

I'm surprised you think this way, bARTc.

--
Eric Sosman
http://www.velocityreviews.com/forums/(E-Mail Removed)lid

Bill Cunningham
Guest
Posts: n/a

 04-28-2009

"Carl" <(E-Mail Removed)> wrote in message
news:gt7bh7\$scq\$(E-Mail Removed)...

[snip]

> I believe you can code it that way. If you are interested, I can post the
> source.

I would much appreciate it. I do what to work with char permutations.
Takes the word "zeus". There's going to have to be a counter somewhere I do
understand that concept. Coding it is different.

Bill

Ben Bacarisse
Guest
Posts: n/a

 04-28-2009
"Bill Cunningham" <(E-Mail Removed)> writes:

> "Ben Bacarisse" <(E-Mail Removed)> wrote in message

<one way to count permutations>
>> ... Can you see the pattern? Could you take an array of n ints an
>> make the "next" counter value from it?

>
> I don't think so. I don't know how to code it. I'm thinking
> using for?

You'd need some loop/loops but I think you should probably try a
simpler problem first. Where do you get these problems from? Do you
finish any of them?

--
Ben.

Carl
Guest
Posts: n/a

 04-28-2009
Bill Cunningham wrote:
> "Carl" <(E-Mail Removed)> wrote in message
> news:gt7bh7\$scq\$(E-Mail Removed)...
>
> [snip]
>
>> I believe you can code it that way. If you are interested, I can post the
>> source.

>
> I would much appreciate it. I do what to work with char permutations.
> Takes the word "zeus". There's going to have to be a counter somewhere I do
> understand that concept. Coding it is different.
>
> Bill
>
>

http://antidom.com/permutation_generator.zip

Is this what you were looking for?

nick_keighley_nospam@hotmail.com
Guest
Posts: n/a

 04-29-2009
On 27 Apr, 22:45, "Bill Cunningham" <(E-Mail Removed)> wrote:
> <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed)...
>
> define "read the number of characters"
> define "sift them around"
>
> <snip>
>
> * * I think I need a char** definition here. Maybe I could replace CHAR_MAX
> with 40 or something like that. I'll post something soon that I believe
> might get me closer.

you didn't give a definition of the two terms

Bill Cunningham
Guest
Posts: n/a

 04-30-2009

"Carl" <(E-Mail Removed)> wrote in message
news:gt7v18\$dla\$(E-Mail Removed)...

>
> http://antidom.com/permutation_generator.zip
>
> Is this what you were looking for?

I can't seem to get it to work on linux. Is this for windows?

Bill

Carl B. Edwinson
Guest
Posts: n/a

 04-30-2009
Richard Heathfield wrote:
> Bill Cunningham said:
>
>> "Carl" <(E-Mail Removed)> wrote in message
>> news:gt7v18\$dla\$(E-Mail Removed)...
>>
>>> http://antidom.com/permutation_generator.zip
>>>
>>> Is this what you were looking for?

>> I can't seem to get it to work on linux. Is this for windows?

>
> No, it's ISO C - or at least, nearly so.
>
>
> 1) added a newline to the end of the file;
> 2) changed two format specifiers from %s to %d for __LINE__
> printing.
>
> I then got a reasonably clean build, which works just fine, although
> the usage instructions are wrong. On the command line, pass the
> length of the desired output as the first command line argument,
> and a series of one or more characters as the second command line
> argument. (The instructions have this the wrong way around.)
>
> For example, if you specify 3 abcd as the command line arguments
> (after the program name), you get this output (which I've piped
> through fmt to reduce vertical space requirements):
>
> aaa baa caa daa aba bba cba dba aca bca cca dca ada bda cda dda
> aab bab cab dab abb bbb cbb dbb acb bcb ccb dcb adb bdb cdb ddb
> aac bac cac dac abc bbc cbc dbc acc bcc ccc dcc adc bdc cdc ddc
>

Sorry about that. I've only had 1 year of C under my belt. This code
was a snippet from a password cracker I was working on. The benefit of
this permutation is that you can start permuting from any point in the
array. So, the idea is to permute the next value, and then let each
thread of the program permute the rest of the elements.

Oh, this was for CUDA, which puts an extremely high price on branching
instuctions. Since each thread will do nearly the exact same thing, the
code is ideal for it. Also, notice that no modulus was used.