Correct Answer
verified
Short Answer
Correct Answer
verified
Multiple Choice
A) Remember the value of root.left (temp = root.left) .
Set root.left to the value of root.left.right.
Set temp.left to root.
Set root to right.
B) Remember the value of root.left (temp = root.right) .
Set root.right to the value of root.right.left.
Set temp.right to root.
Set root to temp.
C) Remember the value of root.left (temp = root.left) .
Set root.left to the value of root.left.right.
Set temp.left to root.
Set temp to root.
D) Remember the value of root.left (temp = root.left) .
Set root.left to the value of root.left.right.
Set temp.right to root.
Set root to temp.
Correct Answer
verified
Multiple Choice
A) Rotate right around parent.
B) Rotate left around child, then rotate right around parent.
C) Rotate left around parent.
D) Rotate right around child, then rotate left around parent.
Correct Answer
verified
True/False
Correct Answer
verified
Short Answer
Correct Answer
verified
Short Answer
Correct Answer
verified
True/False
Correct Answer
verified
Multiple Choice
A) Rotate right around parent.
B) Rotate left around child, then rotate right around parent.
C) Rotate left around parent.
D) Rotate right around child, then rotate left around parent.
Correct Answer
verified
True/False
Correct Answer
verified
True/False
Correct Answer
verified
True/False
Correct Answer
verified
Short Answer
Correct Answer
verified
Multiple Choice
A) 1. if the root is null
2. Create a new tree with the item at the root and return true.
else if the item is equal to root.data
3. The item is already in the tree; return false.
B) 1. if the root is null
2. Create a new tree with the item at the root and return true.
else if the item is equal to root.data 3. The item is already in the tree; return false. else if the item is greater than root.data 4. The processing is symmetric to Steps1 through 3. Note that balance is incremented if increase is true.
C) 1. if the root is null
2. Create a new tree with the item at the root and return true.
else if the item is equal to root.data
3. The item is already in the tree; return false.
else if the item is less than root.data
4. Recursively insert the item in the left subtree.
5.if the height of the left subtree has increased (increased is true)
6. Decrement balance.
7. if balance is zero, reset increase to false.
8. if balance is less than -1
9. Reset increase to false.
10. Perform a rebalanceLeft.
else if the item is greater than root.data
11. The processing is symmetric to Steps 4 through 10. Note that balance is incremented if increase is true.
D) 1. if the root is null
2. Create a new tree with the item at the root and return true.
else if the item is equal to root.data
3. The item is already in the tree; return false.
4. Recursively insert the item in the left subtree. else if the item is greater than root.data
5. The processing is symmetric to Steps 1 through 4. Note that balance is incremented if increase is true.
Correct Answer
verified
Multiple Choice
A) 2-3 trees
B) 2-3-4 trees
C) Red-Black trees
D) B-trees
Correct Answer
verified
Multiple Choice
A) 2-node
B) 3-node
C) 4-node
D) 5-node
Correct Answer
verified
True/False
Correct Answer
verified
Multiple Choice
A) Nodes are always black.
B) The root is always red.
C) A red node always has red children.
D) The number of black nodes in any path from the root to a leaf is the same.
Correct Answer
verified
Short Answer
Correct Answer
verified
Multiple Choice
A) hR - hL
B) hR + hL
C) (hR - hL) *2
D) hR * hL
Correct Answer
verified
Showing 1 - 20 of 28
Related Exams