comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Fastest way to list combinations
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Fastest way to list combinations [message #80811 is a reply to message #80810] Sun, 15 July 2012 08:23 Go to previous messageGo to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On 7/13/12 6:21 PM, antar3s86@gmail.com wrote:
> Hi
>
> I have to solve a problem which includes listing all possible combinations to form a triplet for a given number of objects.
>
> Say you have the objects:
> a,b,c,d,e, so in total 5 which gives you 5!/(2!*3!) = 10 possibilities to list them without any doubles:
>
> abc
> abd
> abe
> acd
> ace
> ade
> bcd
> bce
> bde
> cde
>
> I have solved this problem for any number (well up to some computer limit anyway) in three FOR loops but for large numbers this is rather small...
>
> can you think of a better way than using loops to list all these possibilites?
>
> thanks!!
> :)

You could try COMBIGEN in JBIU.

http://astroconst.org/jbiu/jbiu-doc/math/combigen.html

-Jeremy.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: anything new?
Next Topic: Write on p=plot(....) something like a+-b

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 01:37:13 PDT 2025

Total time taken to generate the page: 0.80791 seconds