Question
***NOTE: You are requested to submit two programs: Write the program using recursive functions Write the program using non-recursive functions Blob Counter: We have a
***NOTE: You are requested to submit two programs: Write the program using recursive functions Write the program using non-recursive functions Blob Counter: We have a two-dimensional grid of cells, each of which may be empty or filled. The filled cells that are connected form a blob. There may be several blobs on the grid. Write a recursive function that accepts as input the indices of a particular cell and returns the size of the blob containing the cell. There are three blobs in the sample grid below. If the function parameters represent the X and Y indices of a cell, the result of BlobCount(matrix, 2, 3) is 0; the result of BlobCount(matrix, 0, 1) is 5; the result of Blobcount(matrix, 4, 4) is 4; the result of BlobCount(matrix, 3, 0) is 2. ALGORITHM: If cell (X, Y) is not in the array then Return a count of 0. Else if cell (X,Y) is empty then Return a count of 0. Else Mark cell (X,Y) as empty. Add 1 and see whether the blob contains any of the eight neighbors of cell (X,Y). Using pointers to a matrix, write a program to read a 5x5 matrix from the user containing stars and dots. Stars represent the blob and the dots represent empty spaces. After you have finished entering the matrix, input a point on the grid (x, y). Find and print the number of cells that form a blob at the point entered. You may use the grid above as an example. Use only pointer offset notation when writing your program.
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