Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Description Consider the following problem which is similar to the one assignment 3 . Suppose we model an apartment with ASCII characters. Specifically, a space
Description
Consider the following problem which is similar to the one assignment
Suppose we model an apartment with ASCII characters. Specifically, a space can be moved
through. An asterisk is a wall or furniture that cannot be traversed. Assume that
is the upper lefthand corner. For the sake of simplicity you can assume the apartment is
enclosed in characters.
Complete the recursive function, recF ill, which to replace all of the characters in the
apartment reachable from the given rowcol location with # characters.
Example:
Starting room:
recFill room, :
########
##
##
##
#####
recFill room, :
##
recFill room, :
since you start at a
Unreachable areas should remain unchanged
Continued on the back
recFillRoom
input: the room to process,
the row and column of the current location being explored
Replace all of the reachable spaces reachable from row col with #
HINT: You dont actually need to know the lengthwidth since the
apartment is fully enclosed in characters
void recFill char room, int row, int col
Base cases:
Recursive cases:
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