0

By combinations algorithm I mean code that will produce output similar to the example below.

I found the C implementation by Knuth already but it used the "goto" statement. PHP 5.2.4 (the version of PHP I must use) does not support "goto". So when I port it to PHP it will error on the goto statments. I could modify it further but I think I might loose efficiency.

Or if not a PHP implementation perhaps an implementation that is not too object-oriented(so that the actual algorithm is not hidden) or an implementation that does not use "goto".

Example: nCr, n=3, r=2

3C2 =

{1,2},{1,3},{2,3}

1 Answers1

0

Maybe you can find here, here or here some solutions.

Community
  • 1
  • 1
Florian
  • 3,015
  • 1
  • 24
  • 36
  • I went with the Chase algorithm in C and converted to PHP. It does not use "goto". –  Jul 09 '11 at 20:25