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
A new approval process is being adapted by Ursa Major Solar. After an opportunity has been approved, the contract is sent to the
BigorU [14]
Install an app :] i think lol
4 0
3 years ago
The amplitudes of the displacement and acceleration of an unbalanced motor were measured to be 0.15 mm and 0.6*g, respectively.
ehidna [41]

Answer:

The speed of shaft is 1891.62 RPM.

Explanation:

given that

Amplitude A= 0.15 mm

Acceleration = 0.6 g

So

we can say that acceleration= 0.6 x 9.81

acceleration,a=5.88\ \frac{m}{s^2}

We know that

a=\omega ^2A

So now by putting the values

a=\omega ^2A

5.88=\omega ^2 \0.15\times 10^{-3}

\omega =198.09\ \frac{rad}{s}

We know that

  ω= 2πN/60

198.0=2πN/60

N=1891.62 RPM

So the speed of shaft is 1891.62 RPM.

                                               

       

4 0
3 years ago
A dielectric material, such as Teflon®, is placed between the plates of a parallel-plate capacitor without altering the structur
Lina20 [59]

Answer: The electric field decreases because of the insertion of the Teflon.

Explanation:

If the charge on the capacitor is held fixed, the electric field as a consequence of this charge distribution (directed from the positive charged plate to the negative charged one remains unchanged.

However, as the Teflon is a dielectric material, even though doesn't allow the free movement of the electrons as an answer to an applied electric field, it allows that the electrons be displaced from the equilibrium position, leaving a local negative-charged zone close to the posiitive plate of the capacitor, and an equal but opposite charged layer close to the negative plate.

In this way, a internal electric field is created, that opposes to the external one due to the capacitor, which overall effect is diminishing the total electric field, reducing the voltage between the plates, and  increasing the capacitance proportionally to the dielectric constant of the Teflon.  

8 0
3 years ago
What is the gear ratio of the given train
Olin [163]

Answer:

1/4

Explanation:

.......................

7 0
2 years ago
Document the XSS stored exploit script: Use the View Source feature of the web page and create a screenshot of the few lines cod
Natali [406]

Answer:

Hold on let me ask my brother

Explanation:

5 0
3 years ago
Other questions:
  • A manufacturer makes integrated circuits that each have a resistance layer with a target thickness of 200 units. A circuit won't
    5·1 answer
  • The steel water pipe has an inner diameter of 12 in. and a wall thickness of 0.25 in. If the valve A is closed and the water pre
    10·1 answer
  • Which pendulum will.mobe faster​
    13·1 answer
  • A disk brake has two pads which cover 45 degrees of the disk. The outside radius is 6.0 inch and the inside radius is 4.0 inch.
    5·1 answer
  • One kg of an idea gas is contained in one side of a well-insulated vessel at 800 kPa. The other side of the vessel is under vacu
    11·1 answer
  • An engineer is considering time of convergence in a new Layer 3 environment design. Which two attributes must be considered? (Ch
    15·1 answer
  • At the instant shown car A is travelling with a velocity of 24 m/s and which is decreasing at 4 m/s2 along the highway. At the s
    14·1 answer
  • 3. (20 points) Suppose we wish to search a linked list of length n, where each element contains a key k along with a hash value
    7·1 answer
  • Which actions would the maintenance and operations crews carry out as a building is completed and preparing to open to the publi
    8·2 answers
  • Which of the following maintenance items helps to ensure the vehicles engine lasts as long as possible?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!