现实和梦想之间的惟一屏障就是努力尝试的信仰,相信一定能行的信仰。
——摘自 奥格.曼狄诺《羊皮卷》
第11 题
求二叉树中节点的最大距离...如果我们把二叉树看成一个图,父子节点之间的连线看成是双向的,
我们姑且定义"距离"为两节点之间边的个数。
写一个程序,
求一棵二叉树中相距最远的两个节点之间的距离。
#include<iostream>
#include<assert.h>
using namespace std;
typedef struct NODE
{
NODE* leftchild;
NODE* rightchild;
int nMaxLeft;
int nMaxRight;
int data;