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
Chad is working on a design that uses the pressure of steam to control a valve in order to increase water pressure in showers. W
Natalija [7]

Answer:

C: Viscosity, the resistance to flow that fluids exhibit

Explanation:

Did it on Edge :)

8 0
3 years ago
Explain by Research how a basic generator works ? using diagram<br>​
natulia [17]
Correcto no se muy bien de que se trata el tema porque está en inglés.
Sorry
8 0
3 years ago
Given frequency, what is the formula for the period of a wave?
Veronika [31]

Answer:

f = c / λ = wave speed c (m/s) / wavelength λ (m). The formula for time is: T (period) = 1 / f (frequency). λ = c / f = wave speed c (m/s) / frequency f (Hz). The unit hertz (Hz) was once called cps = cycles per second.

Explanation:

7 0
3 years ago
An engineering drawing shows the: (A) dimensions, tolerances, cost, and sales or use volume of a component.(B) dimensions, toler
Leto [7]

Answer:

(B) dimensions, tolerances, materials, and finishes of a component.

Explanation:

An engineering drawing :

  An  engineering drawing is a technical drawing which draws the actual component .

An engineering drawing shows

1. Materials

2.Dimensions

3.Tolerance

4.Finishes of a component

Engineering drawing does not shows any information about the cost of component.

So the option B is correct.

3 0
3 years ago
Everyone why are you reporting my answers i didnt do anything to you
masya89 [10]

Answer:

IDK

Explanation:

same thing is happening to me

5 0
3 years ago
Read 2 more answers
Other questions:
  • Which pendulum will.mobe faster​
    13·1 answer
  • Which type of door consists of thin pieces of wood, glass, or louvers placed within a framed rectangular area?
    7·2 answers
  • A piston-cylinder device contains an ideal gas mixture of 3 kmol of He gas and 7 kmol of Ar gas (both gases are monatomic) at 27
    15·2 answers
  • How does the clearance volume affect the efficiency of the Otto cycle?
    11·1 answer
  • Whats the best used for Arch bridge
    11·1 answer
  • Suppose an assembly requires five components from five different vendors. To guarantee starting the assembly on time with 90 per
    14·1 answer
  • PLEASE HELP!!! ILL GIVE BRANLIEST *EXTRA POINTS* dont skip :((
    11·2 answers
  • The human eye, as well as the light-sensitive chemicals on color photographic film, respond differently to light sources with di
    13·1 answer
  • The product of two factors is 4,500. If one of the factors is 90, which is the other factor?
    15·1 answer
  • 8. What are used by the project architect to depict different building systems and to show how they correlate to one anothe
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!