Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A two dimensional array of characters can be considered as a field. Each cell is either water 'W' or a tree 'T'. A forest is
A two dimensional array of characters can be considered as a field. Each cell is either water 'W' or a tree 'T'. A forest is a collection of connected trees. Two trees are connected if they share a side i.e. if they are adjacent to each other with respect to any of the four sides. Given the information about the field, write a function which inputs this 2-D array and returns the size of the largest forest, where size of a forest is the number of trees in it
write code in c++ using function and 2d array
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started