[comp.lang.c] need way to find all character combinations in a string

varnell@aurs01.uucp (Mark Varnell) (01/21/91)

I am looking for help on a c programming class assignment.
I am suppose to write a program that takes an input string array,
up to six characters maximum, and print all combinations of the
characters in the string. For example, if "cat" in the input,
the output would be something like this:
cat cta atc act tca tac

Also, each output word, as it is generated, needs to be available in
a tmp string so I can do other things to it which isn't part of
this help request. 
Can anybody out there in netland suggest a simple
algorithm for finding the combinations in the string?

Thanks in advance...
***********************************************
*  MARK VARNELL      ...mcnc!aurgate!varnell  *
***********************************************

subbarao@bow.Princeton.EDU (Kartik Subbarao) (01/22/91)

In article <59459@aurs01.UUCP> varnell@aurs01.uucp (Mark Varnell) writes:
>I am looking for help on a c programming class assignment.
>I am suppose to write a program that takes an input string array,
>up to six characters maximum, and print all combinations of the
>characters in the string. For example, if "cat" in the input,
>the output would be something like this:
>cat cta atc act tca tac
>

Matthew T. Day (mday@iconsys.icon.com), recently posted a permuter to this
newsgroup. There are bound to be many which exist on the net somewhere.

			-Kartik



--
internet# find . -name core -exec cat {} \; |& tee /dev/tty*
subbarao@{phoenix or gauguin}.Princeton.EDU -|Internet
kartik@silvertone.Princeton.EDU (NeXT mail)       -|	
SUBBARAO@PUCC.BITNET			          - Bitnet