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 transfer function of a typical tape-drive system is given by
maw [93]

Answer:

the range of K can be said to be :  -3.59 < K< 0.35

Explanation:

The transfer function of a typical tape-drive system is given by;

KG(s) = \dfrac{K(s+4)}{s[s+0.5)(s+1)(s^2+0.4s+4)]}

calculating the characteristics equation; we have:

1 + KG(s) = 0

1+   \dfrac{K(s+4)}{s[s+0.5)(s+1)(s^2+0.4s+4)]} = 0

{s[s+0.5)(s+1)(s^2+0.4s+4)]} +{K(s+4)}= 0

s^5 + 1.9 s^4+ 5.1s^3+6.2s^2+ 2s+K(s+4) = 0

s^5 + 1.9 s^4+ 5.1s^3+6.2s^2+ (2+K)s+ 4K = 0

We can compute a Simulation Table for the Routh–Hurwitz stability criterion Table as  follows:

S^5             1                     5.1                          2+ K

S^4            1.9                   6.2                           4K

S^3             1.83            \dfrac{1.9 (2+K)-4K}{1.9}          0

S^2        \dfrac{11.34-1.9(X)}{1.83}       4K                         0

S          \dfrac{XY-7.32 \ K}{Y}        0                            0

\dfrac{1.9 (2+K)-4K}{1.9} = X

 

\dfrac{11.34-1.9(X)}{1.83}= Y

We need to understand that in a given stable system; all the elements in the first column is usually greater than zero

So;

11.34  - 1.9(X) > 0

11.34  - 1.9(\dfrac{3.8+1.9K-4K}{1.9}) > 0

11.34  - (3.8 - 2.1K)>0

7.54 +2.1 K > 0

2.1 K > - 7.54

K > - 7.54/2.1

K > - 3.59

Also

4K >0

K > 0/4

K > 0

Similarly;

XY - 7.32 K > 0

(\dfrac{3.8+1.9K-4K}{1.9})[11.34  - 1.9(\dfrac{3.8+1.9K-4K}{1.83}) > 7.32 \ K]

0.54(2.1K+7.54)>7.32 K

11.45 K < 4.07

K < 4.07/11.45

K < 0.35

Thus the range of K can be said to be :  -3.59 < K< 0.35

4 0
3 years ago
What is the function of filters in communication system ?​
mihalych1998 [28]

In signal processing, a filter is a device or process that removes some unwanted components or features from a signal. Filtering is a class of signal processing, the defining feature of filters being the complete or partial suppression of some aspect of the signal. Most often, this means removing some frequencies or frequency bands. However, filters do not exclusively act in the frequency domain; especially in the field of image processing many other targets for filtering exist.

Explanation:

8 0
3 years ago
What is meant by the dead state. Discuss its significance.
Jlenok [28]

Answer and Explanation:

Dead state can be defined as the state in which both the are ambient properties and the system properties are coincident to each other.

Since the surroundings are similar and these surroundings are fixed also, there will be no kinetic energy and also the gravitational potential energy for both the systems is also equal.

Practically, in thermodynamic studies, the Gravitational potential energy of the system is negligible. This state holds significance because it leads to the termination of all the processes that are spontaneous in nature.

4 0
4 years ago
At a festival, spherical balloons with a radius of 140.cm are to be inflated with hot air and released. The air at the festival
Tpy6a [65]

Answer:

find attached

Explanation:

5 0
3 years ago
Whats a meat trimmer
baherus [9]

Answer:

trime the meat

Explanation:

4 0
3 years ago
Other questions:
  • Water enters a circular tube whose walls are maintained at constant temperature at specified flow rate and temperature. For full
    8·1 answer
  • ______process in sheet metal is used for producing fluid tight joints. A - Hemming B- Seaming C-Beading D-Roll forming
    9·1 answer
  • import java.util.Scanner; public class FindSpecialValue { public static void main (String [] args) { Scanner scnr = new Scanner(
    11·1 answer
  • The article "Some Parameters of the Population Biology of Spotted Flounder (Ciutharus linguatula Linnaeus, 1758) in Edremit Bay
    9·1 answer
  • Emergency plans are being formulated so that rapid action can be taken in the event of an equipment failure. It is predicted tha
    12·2 answers
  • Learning Goal: To use fundamental geometric and statics methods to determine the state of plane stress at the point on an elemen
    8·1 answer
  • What is the weakest link in the security of an IT infrastructure? What are some of the strategies for reducing the risks?
    11·1 answer
  • An automobile having a mass of 1100 kg initially moves along a level highway at 110 km/h relative to the highway. It then climbs
    7·1 answer
  • I need help plz <br><br> Drag each label to the correct location on the image.
    11·1 answer
  • Nanotechnology is a scientific area that deals with making or changing things that are incredibly _______________. *
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!