src/ADT/Tree/BinaryNode.php
public function countNodes()
	{
		$nodes = 1;
		if( $this->left || $this->right )
		{
			if( $this->left )
				$nodes += $this->left->countNodes();
			if( $this->right )
				$nodes += $this->right->countNodes();
		}
		return $nodes;
	}
public function countNodes()
	{
		$nodes = 1;
		if( $this->left || $this->right )
		{
			if( $this->left )
				$nodes += $this->left->countNodes();
			if( $this->right )
				$nodes += $this->right->countNodes();
		}
		return $nodes;
	}
public function countNodes ( ) { $ nodes = 1 ; if ( $ this -> left || $ this -> right ) { if ( $ this -> left ) $ nodes += $ this -> left -> countNodes ( ) ; if ( $ this -> right ) $ nodes += $ this -> right -> countNodes ( ) ; } return $ nodes ; }
Returns the amount of Nodes in the Tree.
@access		public
@return		int
Returns the amount of Nodes in the Tree .