The following figure shows a red-black tree (RBT) T in which…
The following figure shows a red-black tree (RBT) T in which a circle denotes a red node, a square denotes a black node, and the NIL nodes are not shown (to save space). The number inside a circle/square is the key value of the corresponding node. The label (upper-case letter) next to a node is a pointer pointing to the memory location of the corresponding node. You should use the label when referring to a node. (a) Suppose that we want to insert key 26 into the tree in the figure. We first allocate memory for a tree node P and set its color to red and its key to 26. Then we insert it into tree T as if inserting into a binary search tree. After BST insertion (before RBT insertion fixup), the parent of P is [a] (b) Suppose that we want to insert key 26 into the tree in the figure. We first allocate memory for a tree node P and set its color to red and its key to 26. Then we insert it into tree T as if inserting into a binary search tree. After BST insertion (before RBT insertion fixup), which property of RBT is violated? [b] (c) Suppose that we want to insert key 26 into the tree in the figure. We first allocate memory for a tree node P and set its color to red and its key to 26. Then we insert it into tree T as if inserting into a binary search tree. In the resulting RBT, (after RBT insertion fixup), the color of node E is [c] (d) Suppose that we want to insert key 26 into the tree in the figure. We first allocate memory for a tree node P and set its color to red and its key to 26. Then we insert it into tree T as if inserting into a binary search tree. In the resulting RBT, (after RBT insertion fixup), the left child of node P is [d] (e) Suppose that we want to insert key 26 into the tree in the figure. We first allocate memory for a tree node P and set its color to red and its key to 26. Then we insert it into tree T as if inserting into a binary search tree. In the resulting RBT, (after RBT insertion fixup), the parent of node P is [e] (f) Suppose that we want to delete the node D with key 10 from the RBT. After the BST deletion, we need to perform deletion fixup. What case is this deletion fixup? [f] (g) Suppose that we want to delete the node D with key 10 from the RBT. In the resulting RBT (after the deletion fixup), what is the left child of node A? [g] (h) Suppose that we want to delete the node D with key 10 from the RBT. In the resulting RBT (after the deletion fixup), what is the color of node H? [h] (i) Suppose that we want to delete the node D with key 10 from the RBT. In the resulting RBT (after the deletion fixup), what is the left child of node H? [i] (j) Suppose that we want to delete the node D with key 10 from the RBT. In the resulting RBT (after the deletion fixup), what is the right child of node H? [j]
Read Details