Initially the tree looks like:
a) insert 27.
27 greater than root (14), 20, 22 and 25, so 27 becomes the right child of node 25 and colored red.
now both node 25 and node 27 are red.
Both parent and child are red. Node 27 is a right child and its parent 25 is also right child, so it can be solved by single left
rotation from node 22 and switch color of node 22 and node 25.
Now, the tree looks like:
b) Insert 29.
as 29 is the largest node yet in the tree, so it becomes the right child of node 27 as shown below.
both node 29 and 27 are red, and uncle of node 29 i.e node 22 is also red.
so make both uncle and parent of node 29 black and make its grand parent node 25 red, as shown below.
now node 25 is red and is a right child of its parent node 20 which is also red and is also a red node, this can be simple fixed by single left rotation from root node.and switching color of node 14 and 20.
now the tree looks like,
c) remove 20.
node to be deleted is the root, now it has two children so find the largest node in the left subtree (here it is node 16).
copy value of largest node in the left subtree to the node to be deleted and remove node whose value is copied, i.e node 16.
now the tree looks like
d) remove 16
its the same case as above, node to be deleted is root and it has two children.
find the largest node in the left subtree and copy its value to the node to be deleted, and remove the node whose value is copied and coloring child of deleted node black.
now the tree looks like,
Double black node has black sibling and 2 black nephews. Push up black level.
finally the tree looks like,
9. The tree below is a RBT. 14 12 20 16 15 25 (a) (4 points) Insert 27. (b) (4 points) Insert 29 ...
4 15 24 10 1 27 31 14 2 16 32 7 13 36 29 6 1 18 14 15 18 5 20 29 15 7 32 36 17 15 19 35 10 16 39 27 14 1 16 12 13 16 0 20 0.10 005 20 0 25 5 10 S 20 25 30 MacBook Air 2 3 10 15 20 25 30 5 10 15 20 25 30 30 40 10 20 o 1015 2025 30 35 030...
11. In the 2-3 tree given below (i.e., NOT a 2-3-4 tree), execute insert(28), insert(99), and insert(58), in that order, making sure to rebalance after each insertion. Draw the resulting 2-3 tree after executing these operations. 45 20 70 30 60 80 90 2(4(10 11) (25) (40) (50 55) (65) (71 75)(85) (92 96
- 5 8 9 - 10 - 11 12 - 13 14 15 16 Below are the times (in days) it takes for a sample of 16 customers from Sarah's computer store to pay their invoices. 19,15,43, 39, 35, 31, 27, 22, 34, 34, 34, 30, 30, 30, 26, 26 Draw the frequency polygon for these data using an initial class boundary of 14.5 and a class width of 7. Note that you can add or remove classes from the...
Show the 2-3-4 tree after inserting the following keys: 12, 10, 15, 17, 19, 14, 16, 13, 22, 25, and 24. Show the tree after each insertion.
6. For the B+-tree where M=3 and L=5 shown below, show how an insert of value 80 is handled. || 12 || 50 || / | \ / | \ 2 12 50 5 18 65 7 20 70 9 21 72 10 24 78 10 points 7. For the B+-tree where M=3 and L=5 shown below, show how an insert of value 28 is handled. || 24 || 75 || / | \ / | \ / | \...
PLEASE HELP 25. The following figure shows the dynamics of a TCP congestion window. (8 points) 45 40 35 s 30 3 25 20 0 2 4 6 8 10 12 14 16 18 20 22 24 26 Transmission round i) What is the initial threshold? d at the t transmission round that caused the congestion window to change from exponential growh to linear i) What happerned growth? ii) What kind of loss occurred at the 16 transmission round that...
Game Point_Differential Assists Rebounds Turnovers Personal_Fouls 1 15 15 38 11 9 2 36 20 43 8 13 3 16 21 29 7 13 4 45 22 46 11 11 5 12 11 40 7 22 6 -10 10 31 13 26 7 11 19 45 11 7 8 12 16 32 16 14 9 3 16 27 18 15 10 19 9 34 17 17 11 40 16 41 9 17 12 44 12 29 9 22 13 16 ...
1 Binary Search Trees (25 points) Consider the binary tree as shown in Figure 1. 9 5 15 10 17 8 Figure 1: Binary Tree: The letter next to each node (e.g., a, b) denotes the tree node, and the number inside each node is the key. 1.1 Correctness (10 points) Is this binary tree a valid binary search tree? In other words, does it satisfy the binary search tree property? If not, which node(s) violates the binary search tree...
14/ For the data set 8, 6, 29, 3, 9, 23, 15, 18, 5, 3, 22, 27, 4, 2 and 22 the midrange is A./ 16 B/ 11 C/ 15 D/ 18 15/ By the Empirical Rule, in a city of 62,000 people, the number of people below the mean by more than 1 standard deviation is: A./ 41,160 B/ 9, 920 C/ 21,080 D/ 6,200 Questions 16-18 : Use the distribution in the form of the stem-leaf plot. Stem...
Perform the following operations on the nodes {12, -1, 4, 5, 9, 20, 14, 6, 25, 11}: 1. Perform build heap assuming an initially empty heap. 2. Pop the nodes {-1,9,11,25} 3. Insert nodes {0,15,21} 4. Perform heap sort