From 3d7a9df93467de658df46eb2f3bc234428b87730 Mon Sep 17 00:00:00 2001 From: Kestory Date: Thu, 19 Oct 2017 11:48:53 +0800 Subject: [PATCH] fix typo --- C13-Red-Black-Trees/13.1.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/C13-Red-Black-Trees/13.1.md b/C13-Red-Black-Trees/13.1.md index eae0f7ef..fff0fef0 100644 --- a/C13-Red-Black-Trees/13.1.md +++ b/C13-Red-Black-Trees/13.1.md @@ -1,6 +1,6 @@ ### Exercises 13.1-1 *** -In the style of Figure 13.1(a), draw the complete binary search tree of height 3 on the keys {1, 2, ..., 15}. Add the NIL leaves and color the nodes in three different ways such that the black- heights of the resulting red-black trees are 2, 3, and 4. +In the style of Figure 13.1(a), draw the complete binary search tree of height 3 on the keys {1, 2, ..., 15}. Add the NIL leaves and color the nodes in three different ways such that the black-heights of the resulting red-black trees are 2, 3, and 4. ### `Answer` 因为是一颗完全二叉树,超级平衡,所以填色很容易. 感谢[psu](http://test.scripts.psu.edu/users/d/j/djh300/cmpsc465/notes-4985903869437/solutions-to-some-homework-exercises-as-shared-with-students/3-solutions-clrs-13.pdf)提供的图片 @@ -12,10 +12,10 @@ In the style of Figure 13.1(a), draw the complete binary search tree of height 3 Draw the red-black tree that results after TREE-INSERT is called on the tree in Figure 13.1 with key 36. If the inserted node is colored red, is the resulting tree a red-black tree? What if it is colored black? ### `Answer` -插入后如何上红色,那么违反了红节点的儿子节点是黑色这个规则. +插入后如果上红色,那么违反了红节点的儿子节点是黑色这个规则. ![image](./repo/s1/2.png) -插入后如何上黑色,那么违反了路径上包含相同黑节点数这个规则. +插入后如果上黑色,那么违反了路径上包含相同黑节点数这个规则. ![image](./repo/s1/3.png) @@ -49,7 +49,7 @@ What is the largest possible number of internal nodes in a red-black tree with b ### `Answer` 假如有一颗完美二叉树,如果每个节点都是黑的,那么总的节点个数是![](http://latex.codecogs.com/gif.latex?2^k-1) -假如是一黑一红交替,那么总高度就是2k-1,总节点个数是![](http://latex.codecogs.com/gif.latex?2^{2k}-1) +假如是一黑一红交替,那么总高度就是2k,总节点个数是![](http://latex.codecogs.com/gif.latex?2^{2k}-1) ### Exercises 13.1-7