Re: permutation algorithm
- From: Dr John Stockton <jrs@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 11 Aug 2005 15:45:27 +0100
JRS: In article <Oo4mQHdnFHA.3316@xxxxxxxxxxxxxxxxxxxx>, dated Wed, 10
Aug 2005 12:34:50, seen in news:microsoft.public.scripting.vbscript,
Roland Hall <nobody@nowhere.?> posted :
>"Dr John Stockton" wrote in message
>news:YMD6vyARkl9CFwJ9@xxxxxxxxxxxxxxxxxxxxx
>: JRS: In article <#NxvSqlmFHA.2904@xxxxxxxxxxxxxxxxxxxx>, dated Sat, 6
>: Aug 2005 02:43:41, seen in news:microsoft.public.scripting.vbscript,
>: Roland Hall <nobody@nowhere.?> posted :
>:
>: >I'm not sure what type of permutation should would be but I'm trying to
>get
>: >all possible combinations of a string.
>:
>: Combinations are not permutations (in my English).
>
>Sorry to hear that.
You'll see the appropriate usage on the cited page. In a combination,
order does not matter; in a permutation, it does.
>: You can, no doubt, translate the code visible and demonstrated in
>: <URL:http://www.merlyn.demon.co.uk/js-tests.htm#CP>; it could do with
>: independent verification. You'll want to use .split() on your string as
>: a start.
>
>That doesn't work in vbscript.
Use .split() *before* translating to VBScript, so that in the
translation it too is translated <G>.
>: The general approach is to write a function that selects whatever is
>: possible as the first character then calls itself to deal with what is
>: left.
>
>I'm actually looking for the word declining combinations, instead of just
>characters, which y sakuda was so helpful in providing. However, I'm always
>willing to see other possibilities.
The code works on the elements of an array S, which can be whatever
Objects one chooses; characters have an obvious advantage for
convenience of collection and brevity of display. For non-characters,
the expression z+a[j] should be changed to build the result into an
array rather than a string. In the paragraph you quoted, I should have
used 'entity' or 'object' rather than 'character'.
>The j(ava)script routine on your site puts a single comma in the beginning
>and also ends with one. Shouldn't they only be found within the result?
If you mean that after the comma-separated list of items there was
another comma, that's merely an artefact of the previous crude provision
for display.
Change D = "" to D = [] & D += z + "," to D[D.length] = z .
Thanks for causing the thought. D has also been made non-global.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
.
- Follow-Ups:
- Re: permutation algorithm
- From: Roland Hall
- Re: permutation algorithm
- References:
- permutation algorithm
- From: Roland Hall
- Re: permutation algorithm
- From: Dr John Stockton
- Re: permutation algorithm
- From: Roland Hall
- permutation algorithm
- Prev by Date: creating owners
- Next by Date: Re: Count lines in txt file
- Previous by thread: Re: permutation algorithm
- Next by thread: Re: permutation algorithm
- Index(es):
Relevant Pages
|