Question: Help writing a Java method/s that searches a 2 dimensional array, finds the coordinates of a chain of characters, then searches the spaces surrounding those

Help writing a Java method/s that searches a 2 dimensional array, finds the coordinates of a chain of characters, then searches the spaces surrounding those coordinates. If the spaces orthogonal adjacent (up, down, left, right) are not empty then the coordinates in the chain are set to zero.

The method/s should perform the following steps:

Receive a 2 dimensional array[][], a char (either 'b' or 'w').

Perform a search such as a depth first search to find chains of char passed to the method.

Store the coordinates of the chain in a data structure.

Search the spaces adjacent to the coordinates for empty spaces (up, down, left right).

Keep count of the empty spaces and if the count is < 0 then set all the coordinates to empty or ' '.

Return the modified 2D array back to the caller.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!