PHP Binary Tree Recursion Algorithm
问题 I want to create a PHP recursive program using a Binary Tree and Recursion. I want to print the binary tree level by level using recursion. I want to recurse through the tree, push the node into a hashmap that has the level as the reference point. Here's what I have so far: $binary_tree = array(array(1 => array(2 => array(4,5),4=>array(5,6)))); 1 | ------------------ | | 2 4 | | ---------- ---------- | | | | 4 5 5 6 And the end result should look like this: $data[0] = array(1); $data[1] =