[bitlug] Re: problem

  • From: Peeyush Prasad <peeyush@xxxxxxxxxx>
  • To: bitlug@xxxxxxxxxxxxx
  • Date: Mon, 10 May 2004 19:55:50 +0530 (IST)

Hi Firaz,
 Use recursion with for loop to generate all permutations.
should work for any number of objects...
-- P


On 9 May 2004, firaz peer wrote:

> hi there,
>    one of my friends asked me the solution to this problem. since i could not 
> figure out the solution i decided to ask u guys.
>    given a set of numbers, we are to print all possible combinations of 
> numbers that can be formed using those numbers.
>    for example, say we're given 1,2,3. the possible combinations are
> 123
> 132
> 213
> 231
> 321
> 312
>    this is a simple example. but the problem is to solve it for any number of 
> integers. btw nested for loop doesn't work. please send across the code or 
> the logic of the problem a.s.a.p.
>
> thanx.
>
>
> khuda hafiz
>           firaz.
>
>


Other related posts: