Hi, I\'d like some help with this. Programming language is Java. Thanks! -------
ID: 3828969 • Letter: H
Question
Hi, I'd like some help with this. Programming language is Java. Thanks!
-------------------------------------------------------------------------------------------------------------------
Here is the cropped out part of the image I already completed, but is neccessary to see in order to complete the above questions.
2- After returning from findNode(key, p, c), give the code to: (note: don't consider the TreeNode Wrapper class) a) Fetch a deep copy of the node with key 4. b) Insert the node with key field 5. c) Delete the node with key field 6. d) Delete the node with key field 8.Explanation / Answer
Without providing proper algorithm and method signatures, I won't be able to help you out much. Here is as much as I can with the information that you have provided.
2a.
boolean found = findNode(4, P, C);
if (found)
return C.node.deepCopy();
else
return null;
2b.
key = 5;
boolean found = findNode(key, P, C);
if (!found)
if (key < P.node.key)
P.leftChild = key;
else
P.rightChild = key;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.