struct TreeNode
{
int data;
TreeNode *left;
TreeNode *right;
};
int max = INIT_MAX:
int min = INIT_MIN;
int get_max(TreeNode *proot)
{
while( proot != NULL)
{
if (proot->data > max)
max = proot->data;
if (proot->data < min)
min = proot->data;
if (proot->left != NULL)
get_max(proot->left);
if (proot->right != NULL)
get_max(proot->right);
}
return max-min;
}
阅读(1152) | 评论(0) | 转发(0) |