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
For the following conditions determine whether a CMFR or a PFR is more efficient in removing a reactive compound from the waste
andrew11 [14]

Answer:

The PFR is more efficient in the removal of the reactive compound as it has the higher conversion ratio.

Xₚբᵣ = 0.632

X꜀ₘբᵣ = 0.5

Xₚբᵣ > X꜀ₘբᵣ

Explanation:

From the reaction rate coefficient, it is evident the reaction is a first order reaction

Performance equation for a CMFR for a first order reaction is

kτ = (X)/(1 - X)

k = reaction rate constant = 0.05 /day

τ = Time constant or holding time = V/F₀

V = volume of reactor = 280 m³

F₀ = Flowrate into the reactor = 14 m³/day

X = conversion

k(V/F₀) = (X)/(1 - X)

0.05 × (280/14) = X/(1 - X)

1 = X/(1 - X)

X = 1 - X

2X = 1

X = 1/2 = 0.5

For the PFR

Performance equation for a first order reaction is given by

kτ = In [1/(1 - X)]

The parameters are the same as above,

0.05 × (280/14) = In (1/(1-X)

1 = In (1/(1-X))

e = 1/(1 - X)

2.718 = 1/(1 - X)

1 - X = 1/2.718

1 - X = 0.3679

X = 1 - 0.3679

X = 0.632

The PFR is evidently more efficient in the removal of the reactive compound as it has the higher conversion ratio.

3 0
3 years ago
If block A of the pulley system is moving downward at 6 ft&gt;s while block C is moving down at 18 ft&gt;s, determine the relati
kramer

Answer:

Explanation:

The detailed steps and appropriate calculation with analysis is as shown in the attachment.

3 0
3 years ago
A 1000 W iron utilizes a resistance wire which is 20 inches long and has a diameter of 0.08 inches. Determine the rate of heat g
SSSSS [86.1K]

Answer:

The rate of heat generation in the wire per unit volume is 5.79×10^7 Btu/hrft^3

Heat flux is 9.67×10^7 Btu/hrft^2

Explanation:

Rate of heat generation = 1000 W = 1000/0.29307 = 3412.15 Btu/hr

Area (A) = πD^2/4

Diameter (D) = 0.08 inches = 0.08 in × 3.2808 ft/39.37 in = 0.0067 ft

A = 3.142×0.0067^2/4 = 3.53×10^-5 ft^2

Volume (V) = A × Length

L = 20 inches = 20 in × 3.2808 ft/39.37 in = 1.67 ft

V = 3.53×10^-5 × 1.67 = 5.8951×10^-5 ft^3

Rate of heat generation in the wire per unit volume = 3412.15 Btu/hr ÷ 5.8951×10^-5 ft^3 = 5.79×10^7 Btu/hrft^3

Heat flux = 3412.15 Btu/hr ÷ 3.53×10^-5 ft^2 = 9.67×10^7 Btu/hrft^2

3 0
3 years ago
Jodie bought some shirts for 6$ each marge brought some shirts for 8$ each
Alex_Xolod [135]

Answer:

you need more details but if you have to find the difference, its $2.00

Explanation:

8-6=2

3 0
3 years ago
Refer to Figure 9-18. A #_____ electrode lead and workpiece lead should be used to carry 150 amperes of electricity 75 feet to t
Anni [7]

Answer:

AC or

Explanation:

BC

8 0
2 years ago
Other questions:
  • Main technologies used in atms vending machines game consoles and microwave ovens
    6·1 answer
  • In C++ the declaration of floating point variables starts with the type name float or double, followed by the name of the variab
    14·1 answer
  • When choosing a respirator for your job, you must conduct a _____ test.
    15·1 answer
  • he Weather Channel reports that it is a hot, muggy day with an air temperature of 90????F, a 10 mph breeze out of the southwest,
    6·1 answer
  • the frequencies 10, 12, 23 and 45 Hz. (a) What is the minimum sampling rate required to avoid aliasing? (b) If you sample at 40
    13·1 answer
  • The Hubble Space Telescope is an optical imaging telescope with extremely good angular resolution. Someone discovers an object t
    13·1 answer
  • Technician a says that diesel engines can produce more power because air in fuel or not mix during the intake stroke. Technician
    9·1 answer
  • Defination of rolling
    13·1 answer
  • Verify if 83 is a term in the arithmetic sequence 11,15,19,23
    15·1 answer
  • What is the creative process that helps you overcome writer's block called?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!