Question: MATLAB ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
MATLAB Tree Search In this problem, you will complete the depthfirst tree search algorithm
discussed in the lecture. The tres will be given by an adjacency matrix, where you can
assume the root node is node The data will be a separate vector. You will need to
both lind the node value where the data is found as well as truck a history of all nodes
visited.
treesearch Function:
Input variables:
an adjacency matrix for a tree root node is
a vector of dala
a scalar value for which you are searching
Output variables:
a sealar representing node where the value was found if not found
a vector representing all nodes traversed in your depthfirst search
treesearchinner Function:
Simply put this function in the same file as the one above.
Imput variables:
an adjacency matrix for a tree root node is
a vector of data
a scalar value for which you are searching
a scalar representing which node you are currently searching from
Output variables:
a scalar representing index where the value was found if not found
a vector representing all indices that you indexed into the data vector
during the search
A possible sample case is:
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
