已知一棵度为m的树中有:n1个度为1的结点,n2个度为2的结点,……,nm个度为m的结点,问该树中共有多少个叶子结点?
正确答案:设该树的总结点数为n,
则n=n0+n1+n2+……+nm
又:n=分枝数+1=0×n0+1×n1+2×n2+……+m×nm+1由上述两式可得:
N.0=n2+2n3+……+(m-1)nm+1
则n=n0+n1+n2+……+nm
又:n=分枝数+1=0×n0+1×n1+2×n2+……+m×nm+1由上述两式可得:
N.0=n2+2n3+……+(m-1)nm+1
答案解析:有
微信扫一扫手机做题