Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to reorder string variable x factorial different ways?
#12
(04-26-2024, 02:17 PM)bplus Wrote:
Quote:Edit: This worked when I used alpha chars, which is what I want) to do), but when I used anything longer than 7 characters, it gave no result.

these are permutations, there are n! for n elements

N! = 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, ....

that sequence expands faster than any x^n ie expedentially plus!

you propably didn't get results because you didn't wait long enough plus real easy to go beyond the limits of the type fairly quickly.

that routine steve provided i think was better than what i had, except maybe the non recursive one?

i filed the data for 10 letters or digits so i could use a substitution technique for 10 of anything without recalculating permutaions of 10 things because it takes so long.
And one more thing to keep in mind:  What I offered not only does the permutations, but it also checks each permutation against all existing words, to make certain that there's no duplication involved.  (For example "foo" is both "foo"  and "foo", even if you swap the 2nd or 3rd letters.)  I suppose a faster version would probably be to simply generate the list, sort it, and then remove duplicates from the sorted list, but I honestly wasn't thinking folks would be using the code provided for massive length words.   Recursion has a limit to how deep it can go before you run out of stack space.  Without testing, I figured what I had was good enough to work while within that given stack-limit.  Smile
Reply


Messages In This Thread
RE: How to reorder string variable x factorial different ways? - by SMcNeill - 04-27-2024, 01:23 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Experimenting with a "StringList" type for simpler handling of string arrays/lists Heimdall 18 1,263 12-19-2025, 12:51 PM
Last Post: Heimdall
  Sub not Reconizing Dim as String pmackay 18 1,477 10-16-2025, 03:32 PM
Last Post: pmackay
  for performance, what's the best variable type to use for boolean _TRUE & _FALSE ? madscijr 12 1,263 09-29-2025, 02:59 PM
Last Post: dakra137
  Illegal string-number conversion Herve 7 775 07-07-2025, 09:53 AM
Last Post: a740g
  need help printing a scaled string in a custom font to a 32-bit image madscijr 9 1,168 07-03-2025, 04:48 PM
Last Post: SMcNeill

Forum Jump:


Users browsing this thread: 1 Guest(s)