Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

***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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions

Question

4. What is the purpose of the bridge loan facilities? (Appendix)

Answered: 1 week ago

Question

What is Constitution, Political System and Public Policy? In India

Answered: 1 week ago

Question

What is Environment and Ecology? Explain with examples

Answered: 1 week ago