Re: FASTEST way to try all strings (a until ZZZZZZZZZZZZZZZZZZZZZZZZ)
From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 09/28/04
- Next message: John Smith: "Re: Confirmation of delete c#"
- Previous message: DraguVaso: "FASTEST way to try all strings (a until ZZZZZZZZZZZZZZZZZZZZZZZZ)"
- In reply to: DraguVaso: "FASTEST way to try all strings (a until ZZZZZZZZZZZZZZZZZZZZZZZZ)"
- Next in thread: DraguVaso: "Re: FASTEST way to try all strings (a until ZZZZZZZZZZZZZZZZZZZZZZZZ)"
- Reply: DraguVaso: "Re: FASTEST way to try all strings (a until ZZZZZZZZZZZZZZZZZZZZZZZZ)"
- Reply: Jay B. Harlow [MVP - Outlook]: "Re: FASTEST way to try all strings (a until ZZZZZZZZZZZZZZZZZZZZZZZZ)"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 28 Sep 2004 09:21:06 +0100
DraguVaso <pietercoucke@hotmail.com> wrote:
> I need to find the FASTEST way to get a string in a Loop, that goes from "a"
> to "ZZZZZZZZZZZZZZZZZ".
Even using just 17 characters (unlike the last one you've given below)
there are a ridiculous number of combinations. You just *won't* be able
to test every one of them. With 53 symbols (a-z, A-Z, space) you get
205442259656281392806087233013 combinations.
Assuming you could process 100 *billion* of them every second, it would
still take you 65145313183 years to go through them all. Do you really
have that much time?
Now, as for speeding up what you've got: using a StringBuilder instead
of repeated string concatenation would be a good start. Alternatively
you could use a char array. (I haven't checked your actual algorithm
for correctness, btw.)
I note that you're using 52^30 as the number of possible combinations,
which I don't quite understand if you're including space, but even so,
that makes the length of time taken even greater.
Suppose you have a million computers *each* processing 100 billion
combinations a second, to get through 52^30 combinations I suspect
you'd have to wait until way after the sun had gone cold to see the
end.
In other words: you'll need to find a different way of approaching your
problem...
-- Jon Skeet - <skeet@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
- Next message: John Smith: "Re: Confirmation of delete c#"
- Previous message: DraguVaso: "FASTEST way to try all strings (a until ZZZZZZZZZZZZZZZZZZZZZZZZ)"
- In reply to: DraguVaso: "FASTEST way to try all strings (a until ZZZZZZZZZZZZZZZZZZZZZZZZ)"
- Next in thread: DraguVaso: "Re: FASTEST way to try all strings (a until ZZZZZZZZZZZZZZZZZZZZZZZZ)"
- Reply: DraguVaso: "Re: FASTEST way to try all strings (a until ZZZZZZZZZZZZZZZZZZZZZZZZ)"
- Reply: Jay B. Harlow [MVP - Outlook]: "Re: FASTEST way to try all strings (a until ZZZZZZZZZZZZZZZZZZZZZZZZ)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|