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 components of an electronic system dissipating 180 W are located in a 1-m-long horizontal duct whose cross section is 16 cm
oee [108]

Answer:

a) The exit temperature is 39.25°C

b) The highest component surface is 132.22°C

c) The average temperature for air equal to 35°C is a good assumption because the air temperature at the inlet will increase due to the result in the heat gain produced by the duct and whose surface is exposed to a flow of hot.

Explanation:

a) The properties of the air at 35°C:

p = density = 1.145 kg/m³

v = 1.655x10⁻⁵m²/s

k = 0.02625 W/m°C

Pr = 0.7268

cp = 1007 J/kg°C

a) The mass flow rate of air is equal to:

m=\rho *V = 1.145*0.65=0.7443kg/min=0.0124kg/s

The exit temperature is:

T=T_{i} +\frac{Q}{m*c_{p} } =27+\frac{0.85*180}{0.0124*1007} =39.25°C

b) The mean fluid velocity is:

V_{m} =\frac{V}{A} =\frac{0.65}{0.16*0.16} =25.4m/min=0.4232m/s

The hydraulic diameter is:

D_{h} =\frac{4A}{p} =\frac{4*0.16*0.16}{4*0.16} =0.16m

The Reynold´s number is:

Re=\frac{VD_{h} }{v} =\frac{0.4232*0.16}{1.655x10^{-5} } =4091.36

Assuming fully developed turbulent flow, the Nusselt number is:

Nu=0.023Re^{0.8} *Pr^{0.4} =0.023*4091.36^{0.8} *0.7268^{0.4} =15.69

h=\frac{k*Nu}{D_{h} } =\frac{0.02625*15.69}{0.16} =2.57W/m^{2} C

The highest component surface temperature is:

T=T_{e} +\frac{\frac{Q}{A} }{h} =39.2+\frac{0.85*\frac{180}{4*0.16*1} }{2.57} =132.22°C

6 0
4 years ago
What Is Photosynthesis ?​
Fynjy0 [20]

Answer:

Photosynthesis is a process used by plants and other organisms to convert light energy into chemical energy that, through cellular respiration, can later be released to fuel the organism's activities.

6 0
2 years ago
Read 2 more answers
Why do the quadrants in coordinate plane go anti-clockwise?.
tia_tia [17]

Answer:

Quadrants are counter-clockwise because angles are measured counter-clockwise; and angles are measured counter-clockwise so that Cross Product of unit vector in X direction with that in the Y direction has to be the unit vector in the Z direction (coming towards us from the origin).

Explanation:

7 0
3 years ago
Find the total present worth of a series of cash flows with an annual interest rate of 2% per year. Round your answer to the nea
prisoha [69]

The total present worth is $19,783.01

The present worth of a series of cash flow is the value of the cash flows in year 0 (today)

Cash flow in year 0 = 5330

Cash flow in year 1 = 0

Cash flow in year 2 = 0

Cash flow in year 3 = 13075 / (1.02)^3 = 12,320.86

Cash flow in year 4 = 2308 / (1.02)^4 = 2,132.24

Present worth = $19,783.01

A similar question was solved here: brainly.com/question/9641711?referrer=searchResults

5 0
3 years ago
An unknown relative passes away and bequeaths upon you a small tract of land in Amherst. You decide to build a two-story storage
Ratling [72]

Answer: It does make sense, because I've been involved in these careers and have a long family line of them. And other questions?

Explanation:

7 0
3 years ago
Other questions:
  • Magnesium sulfate has a number of uses, some of which are related to the ability of the anhydrate form to remove water from air
    15·1 answer
  • Sketch the velocity profile for laminar and turbulent flow.
    15·1 answer
  • An electric field is expressed in rectangular coordinates by E = 6x2ax + 6y ay +4az V/m.Find:a) VMN if point M and N are specifi
    9·1 answer
  • Am i eating ramon nooddles rn
    10·2 answers
  • Consider five wireless stations A,B,C,D,E. Station
    5·2 answers
  • Write a program in C++ that can be used by a small theater to sell tickets for performances.The theater’s auditorium has 15 rows
    7·1 answer
  • Write a function named is_float(s) that takes one argument that is a string. It returns True if string s represents a floating p
    6·1 answer
  • When did michael faraday invent wind powered electrical generation?
    11·1 answer
  • Agricultural economics is a study of how agriculture and business are related.<br> False<br> True
    15·1 answer
  • When you approach an uncontrolled intersection, you should treat it as though which sign is present?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!