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
I have a stream with three components, A, B, and C, coming from another process. The stream is 50 % A, and the balance is equal
tigry1 [53]

Answer:

X_{A} = \frac{N_{Ao}-N_{A}}{N_{Ao}}

Nₐ₀-Nₐ = 1.33

Nₐ₀ = 2.5

Conversion X = 1.33/2.5 = <u>0.533</u>

Explanation:

A + 2B + 4C ⇒ 2X + 3Y

Given a stream containing 50% A, 25% B and 25% C, to get the limiting reactant, lets take a simple basis

Say stream is 10 moles, this give

A = 5moles

B = 2.5mole

C = 2.5moles

from the balanced equation above,

1mole of A ⇒ 4moles of C

∴ 5moles of A ⇒ (5x4)/1 ⇒ 20moles of C

also;

2mole of B ⇒ 4moles of C

∴ 2.5moles of B ⇒ (2.5x4)/2 ⇒ 5moles of C

so clearly from above reactant C is the limiting reactant.

<em>Note: To get conversion of a process, we must use the limiting reactant. this is because ones it is used up, the reaction comes to an end</em>

<em></em>

Formula to obtain conversion is:

Conversion = (Amount of A used up)/(Amount of A fed into the system)

X_{A} = \frac{N_{Ao}-N_{A}}{N_{Ao}}

where, Nₐ₀-Nₐ = is the amount in moles of A used up

            Nₐ₀ = amount in moles of A fed into the system

The next question is what mole of reactant C will give 0.1mole fraction of Y

Recall our basis = 10moles

<em>from conservation of mass law</em>, 10mole of product must come out which 0.1 moles fraction is Y

therefore amount Y in the product is = 0.1x10 = 1mole

if  3moles of Y ⇒ 4mole of C

∴ 1mole of Y ⇒ (1x4)/3 ⇒ 1.33moles of C

calculating the conversion of limiting reactant C that will give 0.1mole fraction of Y

Nₐ₀-Nₐ = 1.33

Nₐ₀ = 2.5

Conversion X = 1.33/2.5 = <u>0.533</u>

5 0
3 years ago
How many types of arcs do we have in AutoCad? O a.9 O b. 10 Oc. 12 O d. 11​
Dmitry [639]

Answer:

Letter D

Explanation:

AutoCAD provides eleven different ways to create arcs. The different options are used based on the geometry conditions of the design. To create an arc, you can specify various combinations of center, endpoint, start point, radius, angle, chord length, and direction values.

8 0
3 years ago
Read 2 more answers
A transformer has 300,000 windings in its primary coil and uses 12,000V AC input. (4 points) How many windings would be needed t
viva [34]

Answer:

  2750

Explanation:

The number of windings and the voltage are proportional.

__

Let n represent the number of windings to produce 110 Vac. Then the proportion is ...

  n/110 = 300,000/12,000

  n = 110(300/12) = 2750 . . . . multiply by 110

2750 windings would be needed to produce 110 Vac at the output.

7 0
2 years ago
Tahir travel twice as far as ahmed, but onley one third as fast. Ahmed starts travel on tuesday at noon at point x to point z 30
shepuryov [24]

Answer:

6:00 pm the next day

Explanation:

Given that

Tahir traveled twice as far as Ahmed. We say,

Ahmed traveled a distance, D

Tahir would travel a distan, 2D

Tahir traveled 1/3 as fast as Ahmed, so we say

Ahmed traveled at a speed, S

Tahir would travel at a speed, S/3

If Ahmed starts travel on tuesday at noon at point x to point z 300km, by 9:00pm,

Time taken by Ahmed to travel is

9:00 pm - 12:00 pm = 9 hours

Ahmed, traveled 300 km in 9 hours, meaning he traveled at 33.3 km in an hour.

Speed, S that Ahmed traveled with is 33.3 km/h

Remember, we stated that Tahir travels at a speed of S/3, that is, The speed of Tahir is

33.3/3 = 11.1 km/h.

300 km would then be traveled in 300 km/11.1 km/h = 27 hours.

Tahir started traveling, 3 hours after Ahmed, that is 12:00 pm + 3:00 hrs = 3:00 pm, and if he's to spend 27 hours on the journey he would reach destination z at 6:00 pm the next day

7 0
3 years ago
3. Which of the following is an example of qualitative data?
ad-work [718]

Answer:

Number of Items

5 0
3 years ago
Other questions:
  • Engineering is a broad category that includes a variety of occupations and attempts to solve problems using math and
    13·1 answer
  • How many grams of perchloric acid, HClO4, are contained in 37.6 g of 70.5 wt% aqueous perchloric acid? How many grams of water a
    10·1 answer
  • A signalized intersection approach has three lanes with no exclusive left or right turning lanes. The approach has a 40-second g
    10·1 answer
  • Suppose a student rubs a Teflon rod with wool and then briefly touches it to an initially neutral aluminum rod suspended by insu
    6·1 answer
  • Suppose that the time (in hours) required to repair a machine is an exponentially distributed random variable with parameter ???
    13·1 answer
  • Chad is working on a design that uses the pressure of steam to control a valve in order to increase water pressure in showers. W
    5·1 answer
  • E) What are the major jobs of a nurse?<br><br>​
    14·1 answer
  • Characteristics of 3 types of soil​
    10·1 answer
  • For a small company it's usually best to keep the corporate and brand image as___ as possible​
    9·1 answer
  • When recycling paint booth filters, you must put them in an __________ container for transport as a solid waste.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!