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
As the impurity concentration in solid solution of a metal is increased, the tensile strength:________.a) decreasesb) increasesc
valkas [14]

Answer:

Increases

Explanation:

By inhibiting the motion of dislocations by impurities in a solid solutions, is a strengthening mechanism. In solid solutions it is atomic level strengthening resulting from resistance to dislocation motion. Hence, the strength of the alloys can differ with respect to the precipitate's property. Example, the precipitate is stronger (ability to an obstacle to the dislocation motion) than the matrix and it shows an improvement of strength.

5 0
3 years ago
The base class Pet has attributes name and age. The derived class Dog inherits attributes from the base class Pet class and incl
Nonamiya [84]

Answer:

Explanation:

class Pet:

   def __init__(self):

       self.name = ''

       self.age = 0

   def print_info(self):

       print('Pet Information:')

       print('   Name:', self.name)

       print('   Age:', self.age)

class Dog(Pet):

   def __init__(self):

       Pet.__init__(self)

       self.breed = ''

def main():

   my_pet = Pet()

   my_dog = Dog()

   pet_name = input()

   pet_age = int(input())

   dog_name = input()

   dog_age = int(input())

   dog_breed = input()

   my_pet.name = pet_name

   my_pet.age = pet_age

   my_pet.print_info()

   my_dog.name = dog_name

   my_dog.age = dog_age

   my_dog.breed = dog_breed

   my_dog.print_info()

   print('   Breed:', my_dog.breed)

main()

3 0
3 years ago
Compact fluorescent bulbs are much more efficient at producing light than are ordinary incandescent bulbs. They initially cost m
Ilia_Sergeevich [38]

Answer:

ordinary bulb total cost is $39.54

fluorescent bulb total cost is $13.05

amount save = 39.54 - 13.05 = $26.49

resistance = 626.1 ohm

Explanation:

in the 1st part

bulb on time = 3 year = 4380 hours

life of bulb = 750 h

so number of bulb required = \frac{4380}{750}

number of bulb required = 6

cost of 6 bulb is = 6 × 0.75 = $4.5

so

cost of operation is = 100 × 4380 × \frac{0.08}{1000}

cost of operation = $35.04

so total cost will be = $4.5 + $35.04  = $39.54

and

when compare with florescent bulb

time = 3 year = 4380 h

life of bulb = 10000 h

so number of bulb required = \frac{4380}{10000}

number of bulb required = 0.43 = 1

cost of 6 bulb is = 1 × 5 = $5

so

cost of operation is = 23 × 4380 × \frac{0.08}{1000}

cost of operation = $8.05

so total cost will be = $5 + $8.05  = $13.05

in part 2nd

total amount save while compare bulb is

amount save = 39.54 - 13.05 = $26.49

and in part 3rd

resistance of bulb is

resistance = \frac{v^2}{P}

resistance = \frac{120^2}{23}

resistance = 626.1 ohm

6 0
3 years ago
Kinetic energy is defined as energy of an object in:
Murrr4er [49]

your answer is c. motion

5 0
3 years ago
Read 2 more answers
In a certain chemical plant, a closed tank contains ethyl alcohol to a depth of 71 ft. Air at a pressure of 17 psi fills the gap
Yuliya22 [10]

Answer:

the pressure at a closed valve attached to the tank 10 ft above its bottom is 37.88 psi

Explanation:

Given that;

depth 1 = 71 ft

depth 2 = 10 ft

pressure p = 17 psi = 2448 lb/ft²

depth h = 71 ft - 10 ft = 61 ft

we know that;

p = P_air + yh

where y is the specific weight of ethyl alcohol ( 49.3 lb/ft³ )

so we substitute;

p = 2448 + ( 49.3 × 61 )

= 2448 + 3007.3

= 5455.3 lb/ft³

= 37.88 psi

Therefore, the pressure at a closed valve attached to the tank 10 ft above its bottom is 37.88 psi

5 0
3 years ago
Other questions:
  • Researchers compared protein intake among three groups of postmenopausal women: (1) women eating a standard American diet (STD),
    14·1 answer
  • A small family home in Tucson, Arizona has a rooftop area of 2667 square feet, and it is possible to capture rain falling on abo
    5·1 answer
  • Need answers for these please ​
    15·1 answer
  • What are the four basic parts of process plan
    11·1 answer
  • 2. One of the many methods used for drying air is to cool the air below the dew point so that condensation or freezing of the mo
    12·1 answer
  • Barry wants to convert mechanical energy into electric energy. What can he use?
    5·2 answers
  • An engine jack is used to lift a 265-lb engine 6'. How much work, in ft-lb, is performed?
    11·1 answer
  • A fusible link should be how many wire sizes smaller than the actual circuit wire?
    8·1 answer
  • If the 2007 recession affected the green building materials market less seriously than other parts of the construction market, t
    12·2 answers
  • Risks are Not Perceived Differently from What is Happening<br> False<br> True
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!