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
irina1246 [14]
3 years ago
12

You are given a collection of n bottles of different widths and n lids of different widths and you need to find which lid goes w

ith which bottle. You can compare a lid to a bottle, from which you can determine if the lid is larger than the bottle, smaller than the bottle, or the correct size. However, there is no way to compare the bottles or the lids directly to each other, i.e. you can’t compare lids to lids or bottles to bottles. Design an algorithm for this problem with an average-case efficiency of Θ(nlgn)
Engineering
1 answer:
Sladkaya [172]3 years ago
5 0

Answer:

void bubble_sort( int A[ ], int n ) {

     int temp;

     for(int k = 0; k< n-1; k++) {

          // (n-k-1) to ignore comparisons of already compared iterations

         for(int i = 0; i < n-k-1; i++) {

                 if(A[ i ] > A[ i+1] ) {

                      // swapping occurs here

                      temp = A[ i ];

                      A[ i ] = A[ i+1 ];

                      A[ i + 1] = temp ;

                  }

          }

    }

}

You might be interested in
You are the project manager assigned to construct a new 10-story office building. You are trying to estimate the costs for this
Semmy [17]

Answer:

Bottom-up Estimation

Explanation:

Bottom-up estimation is a type of project cost estimation that considers the cost of individual project activities and finally sums them up or finds the aggregates. The summation gives an idea of what the entire project will cost.

This is an effective way of estimating the cost of a project as it evaluates the costs on a wholistic basis. It also considers the tiniest details during the estimation process. The process moves from the simpler details to the more complicated details.

8 0
3 years ago
What are the advantages to a quality<br> saw?
gladu [14]
Ans: A quality handsaw makes jobs such as crosscutting moldings, cleaning out dovetails and flush cutting dowels and pegs faster, cleaner and safer. There are myriad different types and sizes of blades for working with wood and other materials.
7 0
3 years ago
Consider a solid circular shaft subjected to bending and torsion so that the state of stress of interest involves only a normal
Alex17521 [72]

Answer:

The detailed explanation of answer is given in attached file.

Explanation:

7 0
4 years ago
How to make a shopping cart move with ease without a motor. Like if the carts front wheels were smaller than the ones in the bac
Anastasy [175]

Answer:give the cart another shape

Explanation:an aeroplane shape makes it fast,,in physical science,the streamlined body makes a body fast

3 0
4 years ago
Convert mechanical energy into electric energy. What can he use?
Nina [5.8K]

Answer:

<h2>Generator </h2>

Explanation:

A generator converts mechanical energy into electrical energy

7 0
4 years ago
Other questions:
  • The dramatic growth in the number of power data centers, cell towers, base stations, recharge mobiles, and so on is damaging the
    8·1 answer
  • Why the colours of many Airplane are white?<br>​
    11·1 answer
  • A transformer is to be used to provide power for a computer disk drive that needs 6.4 V (rms) instead of the 120 V (rms) from th
    10·1 answer
  • An automotive piston's connecting rod is 8 inches long. What is the approximate length of this connecting rod in millimeters?
    7·1 answer
  • 2+2 = 900000000000000000000000000000000000
    7·1 answer
  • The MAP sensor's vacuum hose is loose and cracking. Technician A says this sensor measures air mass to establish the fuel inject
    14·1 answer
  • It is desired to produce and aligned carbon fiber-epoxy matrix composite having a longitudinal tensile strength of 630 MPa. Calc
    6·1 answer
  • While discussing possible causes of black smoke from the exhaust of an older heavy-duty Diesel engine, technician a says that bl
    10·1 answer
  • In a morphological matrix, which of the following contains the parameters that are essential to a design?
    7·1 answer
  • The modifications of superheat and reheat for a vapor power plant are specifically better for the operation which of the followi
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!