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
Which sentence highlights the best way of site planning?
Nadusha1986 [10]

Answer:

Which sentence highlights the best way of site planning?

A group of construction planners are in a discussion over the most suitable plot to construct new buildings. Steven suggests that they should choose the barren stretch of land in the city and construct cluster buildings. James points out that the wetlands will provide them more area for construction. Riley advises that they should not worry about keeping large open spaces while planning building construction.

Explanation:

8 0
3 years ago
Storm sewer backup causes your basement to flood at the steady rate of 1 in. of depth per hour. The basement floor area is 2600
Wittaler [7]

Answer:

attached below

Explanation:

4 0
3 years ago
thermo A large container ship is propelled by a heat engine that uses fuel oil as a heat source and sea water as a heat sink. Th
TEA [102]

Answer:

\eta = 4.617\times 10^{-4}\,(0.046\,\%), \dot Q_{out} = 162369.444\,kW

Explanation:

The definition of thermal efficiency follows to this expression:

\eta = \frac{\dot W}{\dot Q_{in}}

\eta = \frac{75\,kW}{\left(43000\,\frac{kJ}{L} \right)\cdot \left(13600\,\frac{L}{h} \right)\cdot \left(\frac{1\,h}{3600\,s}  \right)}

\eta = 4.617\times 10^{-4}\,(0.046\,\%)

The rate of heat transfer to the ocean is:

\dot Q_{out} = \dot Q_{in}-\dot W

\dot Q_{out} = \left(43000\,\frac{kJ}{L}  \right)\cdot \left(13600\,\frac{L}{h}  \right)\cdot \left(\frac{1\,h}{3600\,s}  \right)-75\,kW

\dot Q_{out} = 162369.444\,kW

3 0
4 years ago
A manufacturer has been asked to produce 100 customized metal discs with a particular pattern engraved on them. Which production
topjm [15]
I’m just here for points because I have test and I need them lol
8 0
3 years ago
Read 2 more answers
What should you consider when choosing a shotgun as a firearm?
AnnyKZ [126]
Make sure you meet any minimum legal requirements for caliber, gauge, or the amount of energy produced by the projectile.
7 0
2 years ago
Other questions:
  • Webster is giving a speech on the benefits of moving toward the use of windmill energy instead of having to rely on fossil fuels
    7·1 answer
  • Oliver is designing a new children's slide to increase speed at which a child can descend.His first design involved steel becaus
    7·1 answer
  • Technician A says that the first step in diagnosing engine condition is to perform a thorough visual inspection. Technician B sa
    8·1 answer
  • A solid square rod is cantilevered at one end. The rod is 0.6 m long and supports a completely reversing transverse load at the
    13·1 answer
  • Steam at 320°C flows in a stainless steel pipe (k 5 15 W/m·K) whose inner and outer diameters are 5 cm and 5.5 cm, respectively.
    6·1 answer
  • A rectangular bar of length L has a slot in the central half of its length. The bar has width b, thickness t, and elastic modulu
    10·1 answer
  • Tin atoms are introduced into an FCC copper ,producing an alloy with a lattice parameter of 4.7589×10-8cm and a density of 8.772
    9·1 answer
  • 13. The members installed vertically over and under a window opening are called
    9·1 answer
  • Ignorance: noun
    15·1 answer
  • 2. A F-22 Raptor has just climbed through an altitude of 9,874 m at 1,567 kph when a disk
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!