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
List all possible fracture mechanisms under which the unidirectional composites fail. Briefly explain and describe the related m
professor190 [17]

Answer:

Ususushehehehhuuiiïbbb

Explanation:

Yyshehshehshshsheyysysueueue

7 0
3 years ago
The unit for volume flow rate is gallons per minute, but cubic feet per second is preferred. Use the conversion factor tables in
amm1812

Answer:

The conversion factor is 0.00223 ( 1 gallon per minute equals 0.00223 cubic feet per second)

Explanation:

Since the given volume flow rate is gallons per minute.

We know that 1 gallon = 3.785 liters and

1 minute = 60 seconds

Let the flow rate be Q\frac{gallons}{minute}

Now replacing the gallon and the minute by the above values we get

Q'=Q\frac{gallon}{minute}\times \frac{3.785liters}{gallon}\times \frac{1minute}{60seconds}

Thus Q'=0.631Q\frac{liters}{second}

Now since we know that 1 liter = 0.0353ft^{3}

Using this in above relation we get

Q'=0.631Q\frac{liters}{second}\times \frac{0.0353ft^3}{liters}\\\\\therefore Q'=0.00223Q

From the above relation we can see that flow rate of 1 gallons per minute equals flow rate of 0.00223 cubic feet per second. Thus the conversion factor is 0.00223.

3 0
4 years ago
Which of the following would require the filing of an EIS? a. expansion of an airport in a national park b. allowing snowmobiles
alekssr [168]

Answer:

d. All of the above would require an EIS.

Explanation:

A document prepared with the aim of describing the impacts of suggested operations on the environment is an Environmental Impact Statement (EIS). There was a mistake. An Environmental Impact Statement (EIS) is therefore a report describing the environmental effects resulting from a current action. All of the activities above would have an effect on the environment and therefore must fill an EIS

6 0
4 years ago
What should you consider when choosing the type of head protection
Serggg [28]

Answer: hope this helps u

Explanation:

Material,Flexibility,Comfort,Workplace Hazards

6 0
3 years ago
. Chemical manufacturers must present which Information on the product's label?
STatiana [176]

Answer: A) Product identifier

Explanation:

A product identifier is a means, name or number used to identify hazardous and dangerous chemicals on a label or in the SDS( safety data sheet). It provides a special means which helps the user to identify the chemical. Any product identifier used should permit a cross-references to be made among the listed hazardous chemicals required in the written hazard communication program, and the label including SDS(safety data sheet).

5 0
3 years ago
Other questions:
  • tech a says that a tire with more wear on the center of the tread is caused by under inflation of the size tech b says featherin
    12·1 answer
  • There is an electric field near the Earth's surface whose magnitude is about 145 V/m . How much energy is stored per cubic meter
    14·1 answer
  • The working section of a transonic wind tunnel has a cross-sectional area 0.5 m2. Upstream, where the cross-section area is 2 m2
    10·1 answer
  • Input signal to a controller is​
    9·1 answer
  • Convert 25 mm into in.
    13·1 answer
  • Your friend has two substances A and B which are compressed liquid and superheated vapor respectively. Both are in rigid vessels
    15·1 answer
  • For some metal alloy, a true stress of 345 MPa (50040 psi) produces a plastic true strain of 0.02. How much will a specimen of t
    13·1 answer
  • Explain the problems and their possible solution for electricity problems ?​
    8·1 answer
  • Steam at 75 kPa and 8 percent quality is contained in a spring-loaded piston–cylinder device, as shown in Figure, with an initia
    6·1 answer
  • Technician a says that personal protective equipment (ppe) does not include clothing. technician b says that the ppe used should
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!