Question: Complete the implementation of the findNode method below. Purpose: Search the given subtree, rooted at parameter subRoot, for a node containing the element e .
Complete the implementation of the findNode method below.
Purpose: Search the given subtree, rooted at parameter subRoot, for a node containing the element e
Return: If e is found, return reference to the TreeNode object containing e If e is not found, return null.
Note: You may use recursion or iteration as per your preference. You may assume that e is not null.
private TreeNode findNodeE e TreeNode subRoot
your code goes here
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
