protected function order(NaryTree $root = NULL) { if ($root == NULL || $this->realRoot == $root) { return; } foreach ($root->getChildren() as $child) { $this->order($child); } $this->countChildren++; }
protected function order(NaryTree $root = NULL) { if ($root == NULL) { return; } foreach ($root->getChildren() as $child) { $this->order($child); } $this->finalData[] = $root->getData(); }
private function postOrderDestruct(NaryTree $root = NULL) { if ($root == NULL) { return; } foreach ($root->getChildren() as $child) { $this->postOrderDestruct($child); } $root = NULL; }