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
AysviL [449]
3 years ago
11

Suppose you have two arrays: Arr1 and Arr2. Arr1 will be sorted values. For each element v in Arr2, you need to write a pseudo c

ode that will print the number of elements in Arr1 that is less than or equal to v. For example: suppose you are given two arrays of size 5 and 3 respectively. 5 3 [size of the arrays] Arr1 = 1 3 5 7 9 Arr2 = 6 4 8 The output should be 3 2 4 Explanation: Firstly, you should search how many numbers are there in Arr1 which are less than 6. There are 1, 3, 5 which are less than 6 (total 3 numbers). Therefore, the answer for 6 will be 3. After that, you will do the same thing for 4 and 8 and output the corresponding answers which are 2 and 4. Your searching method should not take more than O (log n) time. Sample Input Sample Output 5 5 1 1 2 2 5 3 1 4 1 5 4 2 4 2 5
Engineering
1 answer:
brilliants [131]3 years ago
6 0

Answer:

The algorithm is as follows:

1. Declare Arr1 and Arr2

2. Get Input for Arr1 and Arr2

3. Initialize count to 0

4. For i in Arr2

4.1 For j in Arr1:

4.1.1 If i > j Then

4.1.1.1 count = count + 1

4.2 End j loop

4.3 Print count

4.4 count = 0

4.5 End i loop

5. End

Explanation:

This declares both arrays

1. Declare Arr1 and Arr2

This gets input for both arrays

2. Get Input for Arr1 and Arr2

This initializes count to 0

3. Initialize count to 0

This iterates through Arr2

4. For i in Arr2

This iterates through Arr1 (An inner loop)

4.1 For j in Arr1:

This checks if current element is greater than current element in Arr1

4.1.1 If i > j Then

If yes, count is incremented by 1

4.1.1.1 count = count + 1

This ends the inner loop

4.2 End j loop

Print count and set count to 0

<em>4.3 Print count</em>

<em>4.4 count = 0</em>

End the outer loop

4.5 End i loop

End the algorithm

5. End

You might be interested in
The density of oxygen contained in a tank is 2.0 kg/m3 when the temperature is 25 °C. Determine the gage pressure of the gas if
Verdich [7]

Answer:

57.8408 kPa

Explanation:

Data provided in the question:

Density of oxygen contained, ρ = 2.0 kg/m³

Temperature, T = 25 °C = 25 +273 = 298 K

Atmospheric pressure = 97 kPa.

Now,

Pressure due to gas = ρRT

Here,

R is the gas constant = 259.8 J/kg.K

Thus,

Absolute Pressure due to oxygen = 2 × 259.8 × 298

= 154840.8 Pa

= 154840.8 × 10⁻³ kPa

= 154.84 kPa

Thus,

Gage pressure = Absolute Pressure - Atmospheric pressure

=  154.84 kPa - 97 kPa

= 57.8408 kPa

8 0
3 years ago
A compressor receives air at 290 K, 95 kPa and shaft work of 5.5 kW from a gasoline engine. It should deliver a mass flow rate o
aev [14]

Answer:

P2 = 3.9 MPa

Explanation:

Given that

T₁ = 290 K

P₁ = 95 KPa

Power P = 5.5 KW

mass flow rate  = 0.01 kg/s

solution

with the help of table A5

here air specific heat and adiabatic exponent is

Cp = 1.004 kJ/kg K

and k = 1.4

so

work rate will be

W = m × Cp × (T2 - T1)              ..........................1

here T2 = W ÷ ( m × Cp) + T1    

so T2 = 5.5 ÷ ( 0.001 × 1.004 ) + 290

T2 = 838 k

so final pressure will be here

P2 = P1 × (\frac{T2}{T1})^\frac{k}{k-1}        ..............2

P2 = 95 × (\frac{838}{290})^\frac{1.4}{1.4-1}

P2 = 3.9 MPa

3 0
2 years ago
Benzene gas (C6H6) at 25° C and 1 atm, enters a combustion chamber operating at steady state and burns with 95% theoretical air
tiny-mole [99]

Answer:

Explanation:

Benzene gas is burned with 95 percentage theoretical air during a steady â flow combustion process. The mole fraction of the CO in the products and the heat transfer from the combustion chamber are to be determined

Assumption

steady operating conditions exit .

Air and combustion gases are gases

Kinetic and potential energies are negligible

The fuel is burned with insufficient amount of air and thus the products will contain some CO as well as CO2, H2O and H2

Combustion equation is

C6H6 + ath (O2 + 3.76N2) â 6CO2 +3H2O +3.76ath N2

Where ath is the stoichiometric coefficient and is determined from the O2 balance

ath = 6+1.5 = 7.5

then the actual combustion equation can be written as

C6H6 + 0.95 * 7.5(O2 + 3.76N2) â xCO2 + (6-x) CO + 3H2O + 26.79N2

O2 balance: 0.95 * 7.5 = x +(6-x)/2 +1.5 â x=5.25

Thus C6H6 + 7.125(O2 +3.76 N2) â 5.25 CO2 + 0.75CO + 3H2O + 26.79N2

The mole fraction of CO in the products is

yCO = N CO/ N total = 0.75/5.25 + 0.75+3+26.79

=0.021 or 2.1% mole fraction of the CO in the products

5 0
3 years ago
Read 2 more answers
A steam reformer operating at 650C and 1 atm uses propane as fuel for hydrogen production. At the given operating conditions, th
dusya [7]

Answer:

Explanation:

a) for shifting reactions,

Kps =  ph2 pco2/pcoph20

=[h2] [co2]/[co] [h2o]

h2 + co2 + h2O + co + c3H8 = 1

it implies that

H2 + 0.09 + H2O + 0.08 + 0.05 = 1

solving the system of equation yields

H2 = 0.5308,

H2O = 0.2942

B)  according to Le chatelain's principle for a slightly exothermic reaction, an increase in temperature favors the reverse reaction producing less hydrogen. As a result, concentration of hydrogen in the reformation decreases with an increasing temperature.

c) to calculate the maximum hydrogen yield , both reaction must be complete

C3H8 + 3H2O ⇒ 3CO + 7H2( REFORMING)

CO + H2O ⇒ CO2 + H2 ( SHIFTING)

C3H8 + 6H2O ⇒ 3CO2 + 10 H2 ( OVER ALL)

SO,

Maximum hydrogen yield

= 10mol h2/3 molco2 + 10molh2

= 0.77

⇒ 77%

3 0
3 years ago
At a certain location, wind is blowing steadily at 10 m/s. Determine the mechanical energy of air per unit mass and the power ge
ale4655 [162]

Answer:

<em>a) 50 J/kg</em>

<em>b) 721 67 KW</em>

<em></em>

Explanation:

The velocity of the wind v = 10 m/s

diameter of the blades d = 70 m

efficiency of the turbine η = 30%

density of air ρ = 1.25 kg/m^3

The area of the blade A = \pi d^2/4

A = \frac{3.142 * 70^2}{4} = 3848.95 m^2

The mechanical energy air per unit mass is gives as

e = v^2/2 = \frac{10^2}{2} = <em>50 J/kg</em>

<em></em>

Theoretical Power of the turbine P = ρAve

where

ρ is the density of air

A is the area of the blade

v is the velocity of the wind

e is the energy per unit mass

substituting values, we have

P = 1.25 x 3848.95 x 10 x 50 = 2405593.75 W

Actual power = ηP

where η is the efficiency of the turbine

P is the theoretical power of the turbine

Actual power = 0.3 x 2405593.75 = 721678.1 W

==> <em>721 67 KW</em>

7 0
3 years ago
Other questions:
  • Air at 7°C enters a turbojet engine at a rate of 16 kg/s and at a velocity of 220 m/s (relative to the engine). Air is heated in
    7·1 answer
  • Consider a 1000-W iron whose base plate is made of 0.5-cm-thick aluminum alloy 2024-T6 (rho = 2770 kg/m3 and cp = 875 J/kg·°C).
    12·1 answer
  • A four-lane freeway (two lanes in each direction) is located on rolling terrain and has 12-ft lanes, no lateral obstructions wit
    14·1 answer
  • An air conditioner using refrigerant-134a as the working fluid and operating on the ideal vapor-compression refrigeration cycle
    7·2 answers
  • You will be observing laminar-turbulent transition for room temperature (about 20°C) water flowing in a 0.602"" ID pipe (Schedul
    8·1 answer
  • What are the desired characteristics or values for the following parameters of an ideal amplifier?o Phase change as a function o
    10·1 answer
  • What is the theoretical density in g/cm3 for Lead [Pb]?
    13·1 answer
  • A spring (70 N/m ) has an equilibrium length of 1.00 m. The spring is compressed to a length of 0.50 m and a mass of 2.2 kg is p
    14·2 answers
  • Which of the following is a Dashboard Scoreboard for alignment of the business where information is constantly flowing through t
    5·1 answer
  • Write a paragraph on computer 473
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!