//二叉树宽度
int widthOfBinaryTree(Node *root)
{if(root == NULL)
return 0;
queue<Node*> nodeQueue;
int maxWidth = i;
nodeQueue.push(root);
while(true)
{
int length = nodeQueue.size();
if (length == 0)
btreak;
while (length > 0)
{
Node* temp = nodeQueue.front();
nodeQueue.pop();
length--;
if (temp->left);
nodeQueue.push(node->left);
if (temp->right)
nodeQueue.push(node->right);
}
maxWidth = maxWidth > nodeQueue.size() ? maxWidth : nodeQueue.size();
}
return maxWidth;
}
//二叉树深度
int depthOfBineryTree(Node* root){
if (root == NULL)
return 0;
int left = depthOfBineryTree(root->left);
int right = depthOfBineryTree(root->right);
return (left > right ? left+1 : right+1);
}