数据结构->树:树的深度与高度
2014-06-09 13:21
204 查看
树的高度与深度是不一样的概念:
The depth of a node is the number of edges from the node
to the tree's root node.
A root node will have a depth of 0.
The height of a node is the number of edges on the longest
path from the node to a leaf.
A leaf node will have a height of 0.
但有时候不同书上对只有一个根节点的数的深度有不同的说法,有的认为是0(上例即是),有的认为是1。题目如果涉及到root的深度,应该会给出。
The depth of a node is the number of edges from the node
to the tree's root node.
A root node will have a depth of 0.
The height of a node is the number of edges on the longest
path from the node to a leaf.
A leaf node will have a height of 0.
但有时候不同书上对只有一个根节点的数的深度有不同的说法,有的认为是0(上例即是),有的认为是1。题目如果涉及到root的深度,应该会给出。
相关文章推荐
- 数据结构基础(3)-->队列
- Hadoop Writable深度复制及读取任意<key,value>序列文件
- JAVA答案整理---->微软等公司数据结构、算法面试笔试题(v_JULY_v博主发布)
- <perl> 复杂数据结构 (Reference & Dereference)
- <<C语言深度剖析>>学习笔记之五:指针与数组
- <<C语言深度剖析>>学习之七之函数
- <<C语言深度剖析>>学习笔记之二:关键字详解
- visual formatting model details简译 <三> 之 box的高度
- <<C语言深度剖析>>学习之八之文件结构
- linux设备驱动第三版笔记---->linux驱动重要数据结构之struct file
- java数据结构:ConcurrentSkipListSet&lt;E&gt;与CopyOnWriteArraySet&lt;E&gt;
- <!Doctype html>对body高度影响
- linux设备驱动第三版笔记---->linux驱动重要数据结构之file_operations
- C#中List<T>对象的深度拷贝问题
- linux设备驱动第三版笔记---->linux驱动重要数据结构之inode.
- OpenGL编程指南-->深度缓冲区原理以及为什么要用它
- C#中List<T>对象的深度拷贝问题
- IKanalyzer中文分词源码分析<一>字典的数据结构
- <<C语言深度剖析>>学习笔记之四:预运算符
- <<C语言深度剖析>>学习笔记之六之内存管理