the lexicographical permutation is solution .am i rite??

On Fri, Jul 10, 2009 at 6:33 PM, Spiritus <spirit...@gmail.com> wrote:

>
> Yep, something like
>
> define A[1..n]
>
> Gen(k, l):
>  if(k==0)
>    print A;
>  for(i=1; i<=l; i++)
>    Gen(k-1, A[k]=i);
>
> And, in your case, you should call Gen(n, 3), since you want it with 3
> numbers (e.g. s,d,t will equal 1,2,3)
>
> On Jul 9, 12:18 pm, Miroslav Balaz <gpsla...@googlemail.com> wrote:
> > LOL, you should heve some ordering of elements, and only cnstruct
> > nondecreasing sequence
> > like nuber are like ordered by liek a value, and you can like order any
> > finite set like you want.
> >
> > 2009/7/9 lad4bear <lad4b...@gmail.com>
> >
> >
> >
> > > Thanks for all the help guys.
> >
> > > And Geoff, sorry to be a pain but can you explain a little more fully
> > > what you mean?
> >
> > > Cheers
> >
> > > Pete
> >
> > > On Jul 7, 2:09 pm, Geoffrey Summerhayes <sumr...@gmail.com> wrote:
> > > > On Jul 6, 12:34 pm, lad4bear <lad4b...@gmail.com> wrote:
> >
> > > > > Hi Guys,
> >
> > > > > Here is my situation.
> >
> > > > > The set of room types available is [s, d, t]. A user specifies the
> > > > > number of rooms required [n] and I have to generate a list of
> > > > > permutations.
> >
> > > > > So where n=3 we get [sss, ssd, sst, sdt, std, etc]
> >
> > > > > The problem I have is that sdt and std really are the same.
> >
> > > > > How can I get an efficient list of permutations but without
> > > > > duplicates?
> >
> > > > Easy enough, just pick elements whose index is larger
> > > > than or equal to the last element chosen instead of picking
> > > > from the entire set.
> >
> > > > --
> > > > Geoff
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to