Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How would I remove a node of a binary tree that is unsorted, meaning it is not a

ID: 3653196 • Letter: H

Question

How would I remove a node of a binary tree that is unsorted, meaning it is not a search tree and not balanced (no ordering of nodes by value). It has a structure like so...

I beleive I am going to have to do some checking and move pointers but I am unsure as to how to go about it. I don't beleive there is a need to compare each node value like they do in a Binary SEARCH tree so I am unsure as to how to go about it.

Explanation / Answer

To remove a node u have to point to the next node. Suppose u have an array of nodes then simply change node[i]->left = node[i+1] and node[j].right = node [i+2] use appropriate nodes instead of node[i+1] and node [i+2]

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote