Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Matlab code Function Name: deepestPath Inputs: 1. (cell) A 1xN nested cell array Outputs 1. (char) A character vector describing the deepest path in the

Matlab code image text in transcribed
Function Name: deepestPath Inputs: 1. (cell) A 1xN nested cell array Outputs 1. (char) A character vector describing the deepest path in the woods. Background Recursion just shook your entire world and sense of well being. You no longer can tell left from right, or a double from a char. To get a grip on reality, you decide to take a long, introspective walk into the depths of a nearby forest. You have several different path options and you are trying to decide which one will give you the longest path before you reach a dead end. You quickly realize the complexity of the situation, and you are about to give up when you find a map! Alas, a solution! The map you found is a map of nested cell arrays, and you immediately know what to do. Function Description: Write a recursive function that will search through a nested cell array to find the maximum depth of nested cells. Then output the string 'The deepest path is ca(1, (true,(4,( trees, ((f8, ' >description- deepestPath(ca) description The deepest path is 4 cells deep. Notes: . It does not matter what is found inside of the nested cell. You are only concerned with the depth. Hints: . What should the depth be when the input is not a cell/cell array? . You will need a wrapper function to format the output string. . Consider how you can call the recursive function on every element in the cell array

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions