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
Brainliest need help
insens350 [35]

Answer:

answer c

Explanation:

4 0
2 years ago
An inductor has a 50.0-Ω reactance when connected to a 60.0-Hz source. The inductor is removed and then connected to a 45.0-Hz s
nignag [31]

Given:

X_{L} = 50.0 \ohm

frequency, f = 60.0 Hz

frequency, f' = 45.0 Hz

V_rms} = 85.0 V

Solution:

To calculate max current in inductor, I_{L(max):

At f = 60.0 Hz

X_{L} = 2\pi fL

50.0 = 2\pi\times 60.0\times L

L = 0.1326 H

Now, reactance X_{L} at f' = 45.0 Hz:

X'_{L} = 2\pi f'L

X'_{L} = 2\pi\times 45.0\times 0.13263 = 37.5\ohm

Now, I_{L(max) is given by:

I_{L(max) = \sqrt {\frac{2V_{rms}}{X'_{L}}}

I_{L(max) = \sqrt {\frac{2\times 85.0}{37.5}} = 2.13 A

Therefore,  max current in the inductor, I_{L(max) = 2.13 A

7 0
3 years ago
It is said that Archimedes discovered his principle during a bath while thinking about how he could determine if KingHiero‘s cro
Rudiy27

Answer:

the crown is false densty= 12556kg/m^3[/tex]

Explanation:

Hello! The first step to solve this problem is to find the mass of the crown, this is found using the weight of the crown in the air by means of the equation for the weight.

W=mg

W=weight(N)=31.4N

M=Mass

g=gravity=9.81m/S^2

solving for M

m=W/g

m=\frac{31.4N}{9.81m/S^2}=3.2kg

The second step is find the volume of crown  remembering that when an object is weighed in the water the result is the subtraction between the weight of the object and the buoyant force of the water which is the product of the volume of the crown by gravity by density of water

F=mg-\alpha  V g

Where

F=weight in water=28.9N

m=mass of crown=3.2kg

g=gravity=9.81m/S^2

α=density of water=1000kg/m^3

V= crown´s volume

solving for V

V=\frac{mg-F }{g \alpha } =\frac{(3.2)(9.81)-28.9}{9.81(1000)} =0.000254m^3

finally, we remember that the density is equal to the index between mass and volume

\alpha =\frac{m}{v} =\frac{3.2}{0.000254} =12556kg/m^3

To determine the density of the crown without using the weight in the water and with a bucket we can use the following steps.

1.weigh the crown in the air and find the mass

2. put water in a cylindrical bucket and measure its height with a ruler.

3. Put the crown in the bucket and measure the new water level with a ruler.

4. Subtract the heights, and find the volume of a cylinder knowing the difference in heights and the diameter of the bucket, in order to determine the volume of the crown.

5. find density by dividing mass by volume

7 0
3 years ago
Using the results of the Arrhenius analysis (Ea=93.1kJ/molEa=93.1kJ/mol and A=4.36×1011M⋅s−1A=4.36×1011M⋅s−1), predict the rate
uysha [10]

Answer:

k = 4.21 * 10⁻³(L/(mol.s))

Explanation:

We know that

k = Ae^{-E/RT} ------------------- euqation (1)

K= rate constant;

A = frequency factor = 4.36 10^11 M⁻¹s⁻¹;

E = activation energy = 93.1kJ/mol;

R= ideal gas constant = 8.314 J/mol.K;

T= temperature = 332 K;

Put values in equation 1.

k = 4.36*10¹¹(M⁻¹s⁻¹)e^{[(-93.1*10^3)(J/mol)]/[(8.314)(J/mol.K)(332K)}

k = 4.2154 * 10⁻³(M⁻¹s⁻¹)

here M =mol/L

k = 4.21 * 10⁻³((mol/L)⁻¹s⁻¹)

 or

k = 4.21 * 10⁻³((L/mol)s⁻¹)

or

k = 4.21 * 10⁻³(L/(mol.s))

3 0
3 years ago
You must signal [blank] before any turn or lane change.
Soloha48 [4]
A. 5 seconds :) Good luck!
5 0
3 years ago
Other questions:
  • Assuming the point estimate in Problem 6.36 is the true population parameter, what is the probability that a particular assay, w
    15·1 answer
  • The Cv factor for a valve is 48. Compute the head loss when 30 GPM of water passes through the valve.
    13·1 answer
  • Compact fluorescent bulbs are much more efficient at producing light than are ordinary incandescent bulbs. They initially cost m
    11·1 answer
  • The rigid beam is supported by a pin at C and an A992 steel guy wire AB of length 6 ft. If the wire has a diameter of 0.2 in., d
    14·1 answer
  • Water (density p-1000 is discharging from through a hole at the bottom of a graduated 71 cylinder. The mass flow rate exiting th
    15·1 answer
  • In the designation of wrought Al alloys, eg. 3m, what does the first digit-3- refer to? A. The main alloying element B. Carbon p
    15·1 answer
  • A 5 m deep deposit of sand and silt containing organic layers is to be compacted using explosives placed in the boreholes locate
    13·1 answer
  • Give six reasons why farmers cultivate on small land​
    5·1 answer
  • What Are 2 Properties electromagnets have that permanent magnets do not?
    8·2 answers
  • Explain crystallographic defects.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!