Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

USE MATLAB. NOT JAVA. Use recursion. Function Name: deepestPath Inputs: 1. (cell) A 1xN nested cell array Outputs: 1. (char) A character vector describing the

USE MATLAB. NOT JAVA.

Use recursion.

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 ?num layers cells deep.'. Example: >> ca - {1, ftrue,{4,('trees'J, (1(8, leaves'))) >> description -deepestPath(ca) description The deepest path 1s 4 celIs 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

Handbook Of Relational Database Design

Authors: Candace C. Fleming, Barbara Von Halle

1st Edition

0201114348, 978-0201114348

More Books

Students also viewed these Databases questions

Question

Define an inflation adjusted rate of return and determine its use.

Answered: 1 week ago