正在加载图片...
Preliminaries For any node n the depth of n;is the length of the unique path from the root to /,Thus,the root is at depth 0.The height of n,is the length of the longest path from n,to a leaf.Thus all leaves are at height 0.The height of a tree is equal to the height of the root.The depth of a tree is equal to the depth of the deepest leaf;this is always equal to the height of the tree. If there is a path from m to m,then m is an ancestor of m and m is a descendant of m.If mtm,then m is a proper ancestor of m and m is a proper descendant of m.Preliminaries ◼ For any node ni , the depth of ni is the length of the unique path from the root to ni . Thus, the root is at depth 0. The height of ni is the length of the longest path from ni to a leaf. Thus all leaves are at height 0. The height of a tree is equal to the height of the root. The depth of a tree is equal to the depth of the deepest leaf; this is always equal to the height of the tree. ◼ If there is a path from n1 to n2 , then n1 is an ancestor of n2 and n2 is a descendant of n1 . If n1n2 , then n1 is a proper ancestor of n2 and n2 is a proper descendant of n1
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有