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 code 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

Answers

Answer 1

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

4.3 Print count

4.4 count = 0

End the outer loop

4.5 End i loop

End the algorithm

5. End


Related Questions

2 Select the correct answer from each drop-down menu. Identify the jobs with the type of risks they include. Michael is a/n engineer with the risk of inhaling very small crystalline particles that can cause silicosis, pulmonary diseases, or lung cancer. Tommy is a/n engineer with the risk of exposure to poisonous pollutants in production units when a certain reaction does not follow h. textile Reset Next chemical automobile​

Answers

Answer:

2nd option is correct

Explanation:

as Tommy is an engineer only exposed to poisonous pollutants while Michael is an engineer exposed to small crystalline particles that can cause lung cancer and other diseases

I Hope You Got Your Answer

Three single-phase, 10 kVA, 460/120 V, 60 Hz transformers are connected to form a three-phase 460/208 V transformer bank. The equivalent impedance of each transformer referred to HV side is 1.0 +j2.0 Ω. The transformer delivers 20 kW at 0.8 pf leading. Answer the following questions:
(a) Draw a schematic diagram showing the transformer connection.
(b) Determine the magnitude of transformer primary and secondary winding currents.
(c) Determine the primary voltage magnitude for this operating condition. Determine the voltage regulation

Answers

Answer:

A) attached below

B) I₁ = 18.1 A ,  I₂ = 69.39 A

C)  V( magnitude) = 454.5 ∠ 5.04° V ,  Voltage regulation = ≈  -1.2%

Explanation:

A) Schematic diagram attached below

attached below

B) magnitude of primary and secondary winding currents

I₂ ( secondary current ) = P / √3 * VL * cos∅ ---------- ( 1 )

VL = Line voltage = 208

cos∅  ( power factor ) = 0.8

P = 20 * 10^3 watts

insert values into equation 1

I₂ = 69.39 A

I₁ ( primary current ) = I₂V2 / V1

                               I₁ = ( 69.39 * 120 ) / 460  = 18.1 A

C ) Calculate the Primary voltage magnitude and the Voltage regulation

V(magnitude ) = Vp + ( I₁ ∠∅ ) Req                            ( 1 + j2 = 2.24 ∠63.43° )

                       = 460 + ( 18.1 * cos^-1 (0.8) ) ( 1 + j2 )

                       = 460 + 40.544 ∠ 100.3°

V( magnitude) = 454.5 ∠ 5.04° V

Voltage regulation

= ((Vmag - V1) / V1 )) * 100

= (( 454.5 - 460 / 460 )) * 100

= -1.195 % ≈  -1.2%

What type of sensor is a crankshaft position sensor?

Answers

Answer: Generally, there are four types of crankshaft magnetic pick-up coils, Hall-effect sensors, magneto-resistive element sensors, and optical sensors.

you’re welcome ! please mark me brainliest and leave a thank you.

List down 10 items made from plastic in your home. Describe why each item is made from plastic.

Answers

Answer:

each item is made from plastic are:

water bottlebucketjuggallonplastic bags as poly thin bagto cover wirehandle of knife,pressure cooker,etc plastic roofdustbinplastic plates ,cups

Explanation:

Items made from plastic in our home are

water bottlesjugbucketfood wrappersdisposable plastic cupshand sanitizer bottlesplastic grocery bagsstraws fruit basket Dustbin

items and their uses

Water bottles are used to drink waterfood wrappers are used to wrap the different types of food itemsplastic grocery bags are used to carry grocery itemshand sanitizer bottles are used to store sanitizerfruit basket is used to store and carry fruits .

hope it is helpful to you

The 5-lb cylinder is falling from A with a speed vA = 10 ft/sonto the platform. Determine the maximum displacementof the platform, caused by the collision. The spring has anunstretched length of 1.75 ft and is originally kept incompression by the 1-ft long cables attached to the platform. Neglect the mass of the platform and spring and any energy lost during the collision.

Answers

Answer:  hello some pictorial details related to your question is missing attached below is the missing detail

answer : 0.0735  ft

Explanation:

weight of cylinder = 5 IB

speed  ( v ) = 10 ft/s

Calculate the maximum displacement of platform

Express the initial energy of the system as

potential energy of cylinder + potential energy of spring + Kinetic energy of cylinder

=  mgh + 1/2 ky^2 + 1/2 mv^2

y = initial spring compression = 1.75 - 1 = 0.75

hence the initial energy can be expressed as

= 5 ( 3 + x ) + 1/2 (400)(0.75)^2 + 1/2 ( 5/32.2) (10)^2 ------------ ( 1 )

Next : determine the Final energy of the system

Final energy of the system = potential energy of the system

= 1/2 k ( x + 0.75 )^2  ----- ( 2 )

Equating  equations ( 1 ) and ( 2 )  to determine the value of x

5 ( 3 + x ) + 1/2 (400)(0.75)^2 + 1/2 ( 5/32.2) (10)^2  = 1/2 k ( x + 0.75 )^2

solve for x

x ( max displace of platform )  = 0.0735  ft

The Boeing 787 Dreamliner is billed to be 20% more fuel efficient than the comparable Boeing 767 and will fly at Mach 0.85. The midsize Boeing 767 has a range of 12,000 km, a fuel capacity of 90,000 L, and flies at Mach 0.80. For Boeing 787, assume the speed of sound is 700 mph and calculate the projected volumetric flow rate of fuel for each of the two Dreamliner engines in m3/s.

Answers

Answer:

the projected volumetric flow rate of fuel for each of the two Dreamliner engines is 0.005 m³/s

Explanation:

Given the data in the question;

First we determine the fuel economy of Boeing 767

Range = 12,000 km

fuel capacity = 90,000 L

so,  fuel economy of Boeing 767 will be

η[tex]_f[/tex] = Range / fuel capacity

η[tex]_f[/tex] = ( 12,000 km / 90000 L ) ( 1000m / 1 km) ( 3.7854 L/gal × 264.2 gal/m² )

η[tex]_f[/tex]  = 133,347.024 m/m³

Now, Boeing 787 is 20% more fuel efficient than Boeing 767

so fuel economy of Boeing 787 will be;

⇒ (1 - 20%) × fuel economy of Boeing 767

⇒ (1 - 0.2) × 133,347.024 m/m³

⇒ 0.8 × 133,347.024 m/m³

⇒ 106,677.6 m/m³

Hence, fuel economy of Boeing 787 dream line engine is

⇒ 106,677.6 m/m³ / 2 = 53,338.8 m/m³

Next, we find the velocity of Boeing 787

[tex]V_{787[/tex] = Mach number of 787 × speed of sound

given that; Mach number is 0.85 and speed of sound is 700 mph

we substitute

[tex]V_{787[/tex] = (0.85 × 700 mph) × ( 1 hr / 3600 s ) × ( 1609 m / 1 mile )

[tex]V_{787[/tex] = 265.9319 m/s

Now, to get the Volume flow rate for each dream liner engine { Boeing 787 };

Volumetric flow rate = velocity of flight / fuel economy

we substitute

= 265.9319 m/s / 53,338.8 m/m³

= 0.0049857 ≈ 0.005 m³/s

Therefore,  the projected volumetric flow rate of fuel for each of the two Dreamliner engines is 0.005 m³/s

When you see a school bus stop with its stop sign extended or its lights flashing, you must stop, except for cases when:

Answers

Answer:

Whenever you approach a school bus from any direction, which has stopped to pick up or let off passengers while operating its flashing red lights, you must stop your vehicle at least 25 feet from the school bus. The only time you do not have to stop is when you are on the other side of a divided highway. You must stay stopped until the bus has started again or the bus driver stops operating the flashing red lights.

Other Questions
The problem solving is on the image, 6th grade CAN SOMEONE SEND ME A 2 PARAGRAPH SUMMARY OR OPINION (or both) ON THE MOVIE OF ROMEO AND JULIET, I NEED IT FOR TODAY :( What long tube around the kidneys, carries eggs in females?(Frogs) please help y = kxIn the equation, what does "k" represent? If a circle has an area of 144 sq. cm, what will be its area if the radius is reduced to one third? After reading about the spread of bacteria and viruses, why do we wear a mask to help prevent the spread of corona Which of the following is a good way to reduce salinization?Ause ocean water instead of groundwater to irrigate crossBincrease use of synthetic pesticidesusing rainwater instead of goundwater on cropsDadopt no-lill farming methods Look at the parallelogram pictured in Figure 1. What is the area of theparallelogram? To prevent young children from working in mines and factories, many states passed laws thatOA. required employers to pay children for workplace injuries..established free public daycare centers for children.OC. required young children to attend school.OD. established a minimum wage for children. HELP PLZZ TIMED TEST 5 MIN LEFT! need help on question 26 Read the sentences below:Grocers know we're more likely to buy certain items on impulse. That's why the gum and candy are placed so close to the checkout aisle.Choose the correct version of the combined sentence. (1 point)Grocers know we're more likely to buy certain items on impulse; that's why the gum and candy are placed so close to thecheckout aisle.ObGrocers know we're more likely to buy certain items on impulse that's why the gum and candy are placed so close to the checkoutaisle.Grocers know we're more likely to buy certain items; on impulse, that's why the gum and candy are placed so close to thecheckout aisle.OdGrocers know we're more likely to buy certain items on impulse, that's why; the gum and candy are placed so close to thecheckout aisle Pls help Ill brainlest Which of the following was from the Flemish timeframe (era)?O Created arrangements using a single flowerO striped/flame colored tulips were popularO used daffodils as a form of currencyO Daffodils were traded similar to current day "stocks" read romans 6:23. write this verse in your own words Mrs. Jasper has end-stage chronic renal disease (ESRD). She missed two dialysis sessions when her husband became ill and was unable to drive. In addition to having clinical manifestations of numerous imbalances detected at her next dialysis session, Mrs. Jasper says her skin is very itchy. Based on her statement about itching, what additional assessment(s) should you perform? Is "within us" parallel to "within out Lightning can cause a forest fire, destroying the majority of plants in a forest. A forest fire will do all of the following EXCEPT The blending together of some genes is called: The graphs of linear functions fand g are shown on the grid.which function best represented by the graph of g