1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Anna35 [415]
3 years ago
12

Write a function, in the programming language of your choice, which finds contiguous regions (or "islands") in a matrix where al

l values in the island are greater than a threshold (but not necessarily the same). The function should take a threshold, a minimum island size, and an arbitrarily sized matrix as inputs. The function should output a matrix (same size as the input matrix) of booleans. Do not wrap around matrix edges. Corner neighbors are not sufficient for island continuity. For example, if the the inputs are: threshold = 5, min island size = 3, and matrix = [4, 4, 4, 2, 2; 4, 2, 2, 2, 2; 2, 2, 8, 7, 2; 2, 8, 8, 8, 2; 8, 2, 2, 2, 8]. Then the output would be [0, 0, 0, 0, 0; 0, 0, 0, 0, 0; 0, 0, 1, 1, 0; 0, 1, 1, 1, 0; 0, 0, 0, 0, 0].
Engineering
1 answer:
ExtremeBDS [4]3 years ago
4 0

Answer:

#include <stdio.h>

int main()

{

int threshold = 5;

int i,j;

int matrix[5][5] = {{4, 4, 4, 2, 2},

{4, 2, 2, 2, 2},

{2, 2, 8, 7, 2},

{2, 8, 8, 8, 2},

{8, 2, 2, 2, 8}};

int row=(sizeof(matrix)/sizeof(matrix[0])); // length of row

int column=(sizeof(matrix)/sizeof(matrix[0][0]))/row; // length of column

printf("Input matrix value:\n");

for(i=0; i <5; i++)  

{

for(j=0; j<5; j++)

{

printf("%d ", matrix[i][j]);

}

printf("\n");

}

printf("\n");

for(i=0; i<column; i++)  

{

for(j=0; j<column; j++)

{

if ( (j == 0) || (j == column-1) ) // print 0 for first and last element of every row

printf("%d ", 0);

else

{

if(matrix[i][j] > threshold) // veify whether the element is more than threshold

{

printf("%d ",1);

}

else

{

printf("%d ", 0);

}

}

}

printf("\n");

}

return 0;

}

You might be interested in
A liquid refrigerant (sg=1,2) is flowing at a weight flow rate of 20,9 N/h. Refrigerant flashes into a vapor and its specific we
Iteru [2.4K]

Answer:

Explanation:

volume of 20.9 N

= 20.9 / 11.5 m³

= 1.8174 m³

In one hour 1.8174 m³ flows

in one second volume flowing = 1.8174 / 60 x 60

= 5 x 10⁻⁴ m³

Rate of volume flow = 5 x 10⁻⁴ m³ / s .

5 0
3 years ago
9. How is the Air Delivery temperature controlled during A/C operation?
Rzqust [24]

Answer:

i believe the answer is a but i could be wrong

Explanation:

i hope it helps

6 0
3 years ago
How to get on your screen on 2k20 in every mode
VashaNatasha [74]
D pad or rb or lb hop this helps
5 0
3 years ago
Read 2 more answers
Give five general principles involved in the process of sewage filtration?​
aleksandr82 [10.1K]

Answer:

Some general principles are given below in the explanation segment.

Explanation:

Sewage treatment seems to be a method to extract pollutants from untreated sewage, consisting primarily of domestic sewage including some solid wastes.

<u>The principles are given below:</u>

  • Unless the components throughout the flow stream become greater than the ports or even the gaps throughout the filter layer, those holes would be filled as either a result of economic detection.
  • The much more common element of filtration would be the use of gravity to extract a combination.
  • Broadcast interception or interference.  
  • Inertial influence.
  • Sieving seems to be an excellent method to distinguish particulates.

8 0
3 years ago
QUESTION 3
lianna [129]
D D D D D D D D D D D D D D D DdDdddddf
6 0
3 years ago
Other questions:
  • What does basic levels of competence involves??​
    13·2 answers
  • Two cars A and B leave an intersection at the same time. Car A travels west at an average speed of x miles per hour and car B tr
    9·1 answer
  • Two technicians are discussing solder wire repair. Technician A says that electrical tape can be used to cover the joint. Techni
    10·1 answer
  • a. To measure the water current in an ocean, a marker is dropped onto it. Determine if the trajectory traced by the drifting mar
    5·1 answer
  • This elementary problem begins to explore propagation delayand transmission delay, two central concepts in data networking. Cons
    6·1 answer
  • A proposed embankment fill requires 7100 ft of compacted soil. The void ratio of the compacted fill is specified as 0.5. Four bo
    10·1 answer
  • Estimate (a) the maximum, and (b) the minimum thermal conductivity values (in W/m-K) for a cermet that contains 76 vol% carbide
    9·1 answer
  • 3.
    7·1 answer
  • A) Consider an air standard otto cycle that has a heat addition of 2800 kJ/kg of air, a compression ratio of 8 and a pressure an
    7·1 answer
  • a storage tank contains liquid with a density of 0.0361 lbs per cubic inch. the height of liquid in the tank is 168 feet. what i
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!