You are here: Re: Combination or Permutation question! « PHP Programming Language « IT news, forums, messages
Re: Combination or Permutation question!

Posted by Oli Filth on 03/29/06 14:14

Alkimake said the following on 29/03/2006 09:36:
> here the main problem begins. :)
>
> if i control every each $v then execution goes and goes forever.
> Actually i tried but i could not get combinations. Thanks for helping
> but if you can modify the code to do combinations i would really like
> to know. Thanks again.

I'll give you a clue (because I'm mean ;) ).

In getPermutations(), the next layer of recursion is being passed the
current array, bit with the current value of the foreach loop removed.

To make a getCombinations(), you'll need to pass only items to the right
of the current foreach value.

You can do this by altering two lines of code in the function I gave you...


--
Oli

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация