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
AVprozaik [17]
3 years ago
8

Say you have a random, unordered list containing 4096 four-digit numbers. Describe the most efficient way to: sort the list and

then search for 100 elements within the list, and analyze the expected run time for this specific list's sorting and searching.
Engineering
1 answer:
Debora [2.8K]3 years ago
6 0

Answer:

Answer explained below

Explanation:

It is given that numbers are four-digit so maximum value of a number in this list could be 9999.

So we need to sort a list of integers, where each integer lies between [0,9999].

For these given constraints we can use counting sort which will run in linear time i.e. O(n).

--------------------------------------------------------------------------------

Psuedo Code:

countSort(int numList[]) {

int count[10000];

count[i] = 0; for all i;

for(int num in numList){

count[num]+= 1;

}

return count;

}

--------------------------------------------------------------------------------

Searching in this count array will be just O(1).

E.g. Lets say we want to search if 3 was present in the original list.

Case 1: it was present in the original list:

Then the count[3] would have been incremented by our sorting algorithm. so in case element exists then count value of that element will be greater than 0.

Case 2: it was not present:

In this case count[3] will remain at 0. so in case element does not exist then count of that element will be 0.

So to search for an element, say x, we just need to check if count[x]>0.

So search is O(1).

Run times:

Sorting: O(n)

Search: O(1)

You might be interested in
A specimen of commercially pure copper has a strength of 240 MPa. Estimate its average grain diameter using the Hall-Petch equat
romanna [79]

Answer:

3.115× 10^{-3} meter

Explanation:

hall-petch constant for copper is given by

      S_0=25 MPa

      k=0.12 for copper

now according to hall-petch equation

S_Y=S_0 +\frac{K}{\sqrt{D}}

240=25+\frac{0.12}{\sqrt{D}}

D=3.115× 10^{-3} meter

so the grain diameter using the hall-petch equation=3.115×  10^{-3} meter

5 0
3 years ago
Refrigerant-134a enters a 28-cm-diameter pipe steadily at 200 kPa and 20°C with a velocity of 5 m/s. The refrigerant gains heat
Alexandra [31]

Answer:

V = 0.30787 m³/s

m = 2.6963 kg/s

v2 =  0.3705 m³/s

v2 = 6.017 m/s

Explanation:

given data

diameter = 28 cm

steadily =200 kPa

temperature = 20°C

velocity = 5 m/s

solution

we know mass flow rate is

m = ρ A v

floe rate V = Av

m = ρ V

flow rate = V = \frac{m}{\rho}

V = Av = \frac{\pi}{4} * d^2 * v1

V = \frac{\pi}{4} * 0.28^2 * 5

V = 0.30787 m³/s

and

mass flow rate of the refrigerant is

m = ρ A v

m = ρ V

m = \frac{V}{v} = \frac{0.30787}{0.11418}

m = 2.6963 kg/s

and

velocity and volume flow rate at exit

velocity = mass × v

v2 = 2.6963 × 0.13741 = 0.3705 m³/s

and

v2 = A2×v2

v2 = \frac{v2}{A2}

v2 = \frac{0.3705}{\frac{\pi}{4} * 0.28^2}

v2 = 6.017 m/s

7 0
3 years ago
Select all that apply: Contaminated sharps should<br><br> not be<br><br> ----
PIT_PIT [208]

Answer:

Contaminated sharps should not be bent, recapped or removed.

Explanation:

Contaminated sharps are defined as "any contaminated object that can penetrate the skin including, but not limited to, needles, scalpels, broken glass, broken capillary tubes and exposed ends of dental wires".

4 0
3 years ago
Why is flexibility the most obvious benefit of road transportation select all that apply
ser-zykov [4K]
What am I going to select?? What are my choices bro????
7 0
3 years ago
Explain The Basic Difference Between Bs2 And Bs3 Engine.​
snow_tiger [21]

Answer:

The main difference between the bs2 and bs3 engine is to present in the catalytic converter. And in bs2 engines the catalytic converter is does not used for the formation of hc and co. In bs3 engine there is no harmful emissions in the hc and co

3 0
3 years ago
Other questions:
  • Only put coolant into your radiator when the engine is _____.
    11·1 answer
  • Sed is a multipurpose tool that combines the work of several filters. sed performs noninteractive operations on a data stream. s
    12·1 answer
  • Where the velocity is highest in the radial direction? Why?
    9·1 answer
  • An inductor (L = 400 mH), a capacitor (C = 4.43 µF), and a resistor (R = 500 Ω) are connected in series. A 44.0-Hz AC generator
    11·1 answer
  • The design specifications of a 1.2-m long solid circular transmission shaft require that the angle of twist of the shaft not exc
    15·1 answer
  • Which of these is least likely a step in replacing a failed compressor?
    12·2 answers
  • When welding stick (SMAW) what is the distance between top of bare end of electrode and base metal?
    7·1 answer
  • If you owned a business, what are some of the ways you could follow green computing recommendations with regards to recycling an
    13·1 answer
  • Name the ferrous metal that most workshop tools are made from??
    12·2 answers
  • Which one of the following is not an economic want?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!