Question: 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
Get step-by-step solutions from verified subject matter experts
