I'll try :)

input - arrayA, arrayB


while arrayA has values
{
  take value of arrayA one by one

  while arrayB has values
  {
    add combination of value from arrayA and arrayB into the result as
array
  }
}

return result


.. if combinations are only the pairs of numbers (I hope so :) , I
don't think it's that hard to understand .. it's only about
understanding the PHP array functions.


On 6 čvn, 16:05, Daniel Lohse <[email protected]> wrote:
> Hey guys,
>
> I'm in the middle of my diploma thesis and I have a little Math problem. I 
> needed an algorithm that takes arrays with numbers in them and calculates all 
> possible combinations out of these – much like a tree diagram, only in code. 
> :) So, I found something on the net (please don't bash me) and I do know that 
> it's a non-recursive function (which is good). But I can't for the life of me 
> figure out how it does what it does.
>
> I thought that someone here could help me out with this? I pasted it 
> here:http://pastebin.com/jtpEDnkj
>
> The class takes this input:
>
> array(
>   array(1, 2),
>   array(3, 4)
> )
>
> and returns this after having done its thing:
>
> array(
>   array(2, 3),
>   array(2, 4),
>   array(1, 3),
>   array(1, 4)
> )
>
> It works great but I need this in pseudo-code. :(
>
> Any help is very much appreciated!
>
> Daniel

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to