-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f64bcd
commit 3e1a6ba
Showing
17 changed files
with
224 additions
and
6 deletions.
There are no files selected for viewing
Binary file added
BIN
+30.8 KB
...zh_CN/_images/appendices/recommended-books/86c9860fb895d6c391e461f975f60157.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+69.4 KB
...zh_CN/_images/appendices/recommended-books/9d86001ba8d64425e44fb1a40c95cce2.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.25 KB
docs/zh_CN/_images/binary-tree/definations/020e6de667d476f113ce0115658f4a6c.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.59 KB
docs/zh_CN/_images/binary-tree/definations/142023250664309e83c15e256ca9456a.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+30.5 KB
docs/zh_CN/_images/binary-tree/definations/4ee27714ed5cc57475d9f359025585d1.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+18.8 KB
docs/zh_CN/_images/binary-tree/definations/7f3bd013112cd06401a43ab4ba888d6f.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.41 KB
docs/zh_CN/_images/binary-tree/definations/e47d6b47f107cba8c5d4fea91967021b.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.82 KB
docs/zh_CN/_images/binary-tree/definations/f1e5132ea80d1e751cd0c5497083f801.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
.. 附录 | ||
FileName: index.rst | ||
Author: Fasion Chan | ||
Created: 2018-03-03 11:45:04 | ||
@contact: fasionchan@gmail.com | ||
@version: $Id$ | ||
Description: | ||
Changelog: | ||
Note: | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
.. meta:: | ||
:keywords: Data Structure, Algorithm, C++, Javascript, Python, 数据结构, 算法 | ||
|
||
==== | ||
附录 | ||
==== | ||
|
||
.. toctree:: | ||
:titlesonly: | ||
|
||
推荐书单 <recommended-books> | ||
|
||
.. comments | ||
comment something out below |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
.. 推荐书单 | ||
FileName: index.rst | ||
Author: Fasion Chan | ||
Created: 2018-03-03 11:45:04 | ||
@contact: fasionchan@gmail.com | ||
@version: $Id$ | ||
Description: | ||
Changelog: | ||
Note: | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
.. meta:: | ||
:description lang=zh: | ||
数据结构与算法学习推荐书单,涵盖基础理论与C、C++、Java、Javascript等语言描述。 | ||
:keywords: Data Structure, Algorithm, C++, Javascript, Python, 数据结构, 算法, 推荐书单 | ||
|
||
======== | ||
推荐书单 | ||
======== | ||
|
||
.. figure:: /_images/appendices/recommended-books/9d86001ba8d64425e44fb1a40c95cce2.jpg | ||
:width: 160px | ||
:target: https://book.douban.com/subject/20432061/ | ||
|
||
*算法导论* | ||
👉 `豆瓣 <https://book.douban.com/subject/20432061/>`__ | ||
|
||
C++ | ||
=== | ||
|
||
.. figure:: /_images/appendices/recommended-books/86c9860fb895d6c391e461f975f60157.jpg | ||
:width: 160px | ||
:target: https://book.douban.com/subject/25956449/ | ||
|
||
*数据结构与算法分析(C++版)* | ||
👉 `豆瓣 <https://book.douban.com/subject/25956449/>`__ | ||
|
||
下一步 | ||
====== | ||
|
||
.. include:: /_fragments/next-step-to-wechat-mp.rst | ||
|
||
.. include:: /_fragments/disqus.rst | ||
|
||
.. include:: /_fragments/wechat-reward.rst | ||
|
||
.. comments | ||
comment something out below | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
.. | ||
Author: fasion | ||
Created time: 2019-07-28 19:46:17 | ||
Last Modified by: fasion | ||
Last Modified time: 2019-07-29 16:37:36 | ||
.. meta:: | ||
:description lang=zh: | ||
本文讨论二叉树相关术语,包括根、父子节点、叶子节点、高度、深度等; | ||
并介绍两个特殊的二叉树形态——满二叉树以及完全二叉树。 | ||
:keywords: binary tree, full binary tree, complete binary tree, root, parent, child, ancestor, descendent, height, depth, level, terminology, 二叉树, 满二叉树, 完全二叉树, 根, 父节点, 子节点, 祖先节点, 子孙节点, 高度, 深度, 层, 术语 | ||
|
||
========== | ||
二叉树定义 | ||
========== | ||
|
||
术语 | ||
==== | ||
|
||
.. figure:: /_images/binary-tree/definations/4ee27714ed5cc57475d9f359025585d1.jpg | ||
|
||
- **根** ( `root` ),即 *A* ,为树中 **最顶节点** ,该节点 **没有父节点** ; | ||
- *A* 为 *B* 的 **父节点** ( `parent` ); | ||
- *E* 为 *B* 的 **子节点** ( `child` ); | ||
- *A* 、 *B* 为 *E* 的 **祖先节点** ( `ancestor` ); | ||
- *B* 、 *E* 为 *A* 的 **子孙节点** ( `descendent` ); | ||
- *I* 、 *J* 互为 **兄弟节点** ( `sibling` ), **父节点相同** ; | ||
- **高度** ( `height` ),节点到最远子孙的距离; | ||
- *A* 高度为 *3* ; | ||
- *H* 高度为 *1* ; | ||
- *I* 高度为 *0* ; | ||
- **深度** ( `Depth` ),节点到根的距离; | ||
- *A* 深度为 *0* ; | ||
- *H* 深度为 *2* ; | ||
- *I* 高度为 *3* ; | ||
- 节点可按深度分 **层** ( `level` ); | ||
- 根为第 *0* 层; | ||
- *I* 、 *J* 为第 *3* 层; | ||
- *H* 及其全部子孙节点组成一颗 **子树** ( `subtree` ); | ||
|
||
|
||
满二叉树 | ||
======== | ||
|
||
**满二叉树** ( `Full Binary Tree` )中,每个节点要么没有子节点( `child` ),要么有两个子节点。 | ||
|
||
.. figure:: /_images/binary-tree/definations/020e6de667d476f113ce0115658f4a6c.png | ||
|
||
*满二叉树* | ||
|
||
完全二叉树 | ||
========== | ||
|
||
**完全二叉树** ( `Complete Binary Tree` ),有以下两个性质: | ||
|
||
#. 除了最后一层,其他所有层都是满的; | ||
#. 最后一层节点尽可能地靠着最左边; | ||
|
||
.. figure:: /_images/binary-tree/definations/142023250664309e83c15e256ca9456a.png | ||
|
||
*完全二叉树* | ||
|
||
由于完全二叉树逐层从左到右排列, 因此对于给定节点数的树, **形态只有一种** 。 | ||
因此,完全二叉树可以用一个数组来表示: | ||
|
||
.. figure:: /_images/binary-tree/definations/f1e5132ea80d1e751cd0c5497083f801.png | ||
|
||
*完全二叉树数组表示* | ||
|
||
为每个节点编号, **根节点** 为 *0* ,那么编号即是节点在数组中的 **下标** : | ||
|
||
.. figure:: /_images/binary-tree/definations/e47d6b47f107cba8c5d4fea91967021b.png | ||
|
||
对于节点 :math:`i` ,其: | ||
|
||
- **父节点** 为: :math:`\frac{i - 1}{2}` ; | ||
- **左子节点** 为: :math:`2i + 1` ; | ||
- **右子节点** 为: :math:`2i + 2` ; | ||
|
||
下一步 | ||
====== | ||
|
||
.. include:: /_fragments/next-step-to-wechat-mp.rst | ||
|
||
.. include:: /_fragments/disqus.rst | ||
|
||
.. include:: /_fragments/wechat-reward.rst | ||
|
||
.. comments | ||
comment something out below | ||
.. figure:: /_images/binary-tree/definations/7f3bd013112cd06401a43ab4ba888d6f.png | ||
树中唯一没有父节点的节点为 **根节点** ( `root` ),如图节点 *0* 。 | ||
**路径** ( *Path* ) | ||
- **路径** ( `path` ),; | ||
*A* 、 *G* 的路径为 *ADG* ; | ||
.. figure:: /_images/binary-tree/definations/7f3bd013112cd06401a43ab4ba888d6f.png | ||
对于上图节点 *3* , | ||
- 节点 *1* 是 **父节点** ( `parent` ); | ||
- 节点 *4* 是 **兄弟节点** ( `sibling` ); | ||
- 节点 *6* 是 **左子节点** ( `left child` ); | ||
- 节点 *7* 是 **右子节点** ( `right child` ); | ||
另外,节点还可以分成: | ||
- **根节点** ( `root` ),树中唯一 **没有父节点** 的节点; | ||
- **叶子节点** ( `leaf` ),没有子节点; | ||
- **内部节点** ( `internal` ),至少有一个子节点; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters