PHP Binary Tree-like array, get all pathways -
i have array has binary structure (please check array data @ bottom). want find out pathways using item field of every node. below expected answer data @ bottom:
expected answer:
0,1,5,4
0,1,3,4
0,3,4
data:
array ( [0] => array ( [item] => null [count] => 0 [child] => array ( [1] => array ( [item] => 1 [count] => 6 [child] => array ( [5] => array ( [item] => 5 [count] => 3 [child] => array ( [4] => array ( [item] => 4 [count] => 1 [child] => ) ) ) [3] => array ( [item] => 3 [count] => 2 [child] => array ( [4] => array ( [item] => 4 [count] => 1 [child] => ) ) ) ) ) [3] => array ( [item] => 3 [count] => 1 [child] => array ( [4] => array ( [item] => 4 [count] => 1 [child] => ) ) ) ) ) )
Comments
Post a Comment