Boost logo

Boost :

From: Ben Bear (benbearchen_at_[hidden])
Date: 2007-11-13 11:22:00


I put a combi_tr.zip in vault/Algorithms/combi_tr.zip. It contains three files:
combination.hpp: a implementation
example.cpp: a example show initialization and using
test.cpp: test the combination using partial_permutation

It's also available:
http://www.bxmy.org/combi/combination.hpp
http://www.bxmy.org/combi/example.cpp
http://www.bxmy.org/combi/test.cpp

About permutation and combination with repetitions, if select 4
elements from {0, 1, 2}, some code can show them:

repetition permutation:
for (int i = 0; i <= 2; ++i)
  for (int j = 0; j <= 2; ++j)
    for (int k = 0; k <= 2; ++k)
      for (int m = 0; m <= 2; ++m)
        {
          result = {i, j, k, m};
        }

repetition combination:
for (int i = 0; i <= 2; ++i)
  for (int j = i; j <= 2; ++j)
    for (int k = j; k <= 2; ++k)
      for (int m = k; m <= 2; ++m)
        {
          result = {i, j, k, m};
        }

2007/11/13, Hervé Brönnimann <hervebronnimann_at_[hidden]>:
> Ben: The concepts of permutations/combinations with/without
> repetitions are well-known and well-documented. I wouldn't want to
> provide too many examples for those. In any case, it would be OK and
> welcome to show a few instances on some actual sequences for a Boost
> library, but I think would be a waste of space for a C++
> Standardization proposal. I think what Jens is asking for (and I
> intend to provide) are examples of using the proposed API to produce
> and use them. Thanks for your link, though. HB
>
> On Nov 13, 2007, at 7:46 AM, Ben Bear wrote:
>
> > 2007/11/13, Jens Seidel <jensseidel_at_[hidden]>:
> >>
> >> Could you please try to improve it a little bit? Maybe by giving some
> >> examples in the documentation?
> >>
> >
> > Oh, I wrote a php page as combination's demo, you can visit through:
> > http://www.bxmy.org/php/combination.php
> >
> > You can look the php source code:
> > http://www.bxmy.org/php/show.php?filename=combination
> > _______________________________________________
> > Unsubscribe & other changes: http://lists.boost.org/mailman/
> > listinfo.cgi/boost
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk