🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.ansi-iso
Article #6

Re: all possible combinations

#6
From: Adam Anderson
Date: Tue, 07 Mar 2000 00:00
45 lines
2158 bytes
Ok I answered a similar question to this a few weeks ago.

To generate all possible combinations for a given number of symbols, you
use the quantity of symbols as a new base in a number system, 10 is the
base in decimal, 16 is the base in hexidecimal. Once you know the base
you can then use a simple mathematical process to convert an
incrementing decimal number to the new base.

Use lookup tables for the conversion process. For information on the
conversion process look at Decimal to Hex Conversion.

Regards
Adam Anderson

Andrew wrote:

> Anyone have any pascal code for all possible combinations of a set?
>
> So if we start with '1','2','3' the possible combinations are:
>
> 1
> 2
> 3
> 1 2
> 1 3
> 2 3
> 1 2 3
>
> This seems to be a FAQ on discussion groups in general, but
> I could not find anything in Pascal.  I found some C++ code
> in another group but it looks like bad pseudocode to me -- I'm
> kindof a pascal diehard.  But I'm not a big programmer
> and this problem has my brain in knots right now.
>
> A response in any flavor of pascal would be much appreciated.
>
> TIA,
>
>   Andrew
> --
> Andrew
> noymer@my-deja.com
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Technical Details
Message-ID: <38C4496F.432C4F19@mail.newcastle.edu.au>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <89v8r3$vag$1@nnrp1.deja.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 108ebd,77a4248f898f7bd2
X-Google-Attributes: gid108ebd,public
X-Google-Thread: 111659,77a4248f898f7bd2
X-Google-Attributes: gid111659,public
X-Google-Thread: 10261c,77a4248f898f7bd2
X-Google-Attributes: gid10261c,public
X-Google-Thread: 10c950,77a4248f898f7bd2
X-Google-Attributes: gid10c950,public
From: Adam Anderson <aanderso@mail.newcastle.edu.au>
Subject: Re: all possible combinations
Date: 2000/03/07
Message-ID: <38C4496F.432C4F19@mail.newcastle.edu.au>
X-Deja-AN: 594040670
Content-Transfer-Encoding: 7bit
References: <89v8r3$vag$1@nnrp1.deja.com>
X-Accept-Language: en,ja,fr-FR,de-DE
Content-Type: text/plain; charset=us-ascii
Organization: TUNRA
Mime-Version: 1.0
Reply-To: aanderso@mail.newcastle.edu.au
Newsgroups: comp.lang.pascal.ansi-iso,comp.lang.pascal.misc,borland.public.turbopascal,comp.lang.pascal.borland