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
When you learned about the Highway Transportation system you learned about 6 different types of people as
Musya8 [376]

Answer: 3 different types of people using Highway Transportation system are :

1. Pedestrians - should be given priority while driving.

2. Cyclists - should be given enough space on road.

3. Motorcyclists- should be given enough space on road.

Explanation:

1. Pedestrians - Most of pedestrians use to walk on the footpath along side road that keeps them on a safe side. But there are places without footpath along side road, in that case they have to walk on the road itself. Here, we need to take care for them. We need to wait in case they are crossing road and also check for them while taking a turn.

2. Cyclists - They travel on road but are tough to figure out. They travel at a slower pace compared to cars. To avoid any accident with them, we are supposed to give them enough space which should be equivalent to a car's space.

3. Motorcyclists - They can pass by very closely and also come between lanes. Most of the things to be considered here are same as that of cyclists. Here also, we need to check for them carefully while taking a turn. Also, need to give them enough space.

4 0
3 years ago
10% A steel beam W18x76 spans 32 feet and is subjected to a Moment of 334 kips-ft. Find the load w on the beam. Determine the de
Lilit [14]

Answer:

w = 10.437 kips

deflection at 1/4 span  20.83\E ft

at mid span = 1.23\E ft

shear stress  7.3629 psi

Explanation:

area of cross section = 18*76

length of span = 32 ft

moment = 334 kips-ft

we know that

moment = load *eccentricity

334 = w * 32

w = 10.437 kips

deflection at 1/4 span

\delta = \frac{wa^2b^2}{3EI}

= \frac{10.4375*8^2 *24^2}{3E \frac{BD^3}{12}}

         =\frac{10.437 *8^2*24^2}{3E \frac{18*16^3}{12}}

         = 20.83\E ft

at mid span

\delta = \frac{wl^3}{48EI}

= \frac{10.43 *32^3}{48 *E*\frac{18*16^3}{12}}

\delta = 1.23\E ft

shear stress

\tau = \frac{w}{A} = \frac{10.43 7*10^3}{18*76} =7.3629 psi

6 0
3 years ago
An ideal gas initially at 300 K and 1 bar undergoes a three-step mechanically reversible cycle in a closed system. In step 12, p
Veseljchak [2.6K]

Answer:

Ts =Ta E)- 300(

569.5 K

5

Q12-W12 = -4014.26

Mol

AU2s = Q23= 5601.55

Mol

AUs¡ = Ws¡ = -5601.55

Explanation:

A clear details for the question is also attached.

(b) The P,V and T for state 1,2 and 3

P =1 bar Ti = 300 K and Vi from ideal gas Vi=

10

24.9x10 m

=

P-5 bar

Due to step 12 is isothermal: T1 = T2= 300 K and

VVi24.9 x 10x-4.9 x 10-3 *

The values at 3 calclated by Uing step 3l Adiabatic process

B-P ()

Since step 23 is Isochoric: Va =Vs= 4.99 m* and 7=

14

Ps-1x(4.99 x 103

P-1x(29x 10)

9.49 barr

And Ts =Ta E)- 300(

569.5 K

5

(c) For step 12: Isothermal, Since AT = 0 then AH12 = AU12 = 0 and

Work done for Isotermal process define as

8.314 x 300 In =4014.26

Wi2= RTi ln

mol

And fromn first law of thermodynamic

AU12= W12 +Q12

Q12-W12 = -4014.26

Mol

F'or step 23 Isochoric: AV = 0 Since volume change is zero W23= 0 and

Alls = Cp(L3-12)=5 x 8.311 (569.5 - 300) = 7812.18-

AU23= C (13-72) =5 x 8.314 (569.3 - 300) = 5601.53

Inol

Now from first law of thermodynamic the Q23

AU2s = Q23= 5601.55

Mol

For step 3-1 Adiabatic: Since in this process no heat transfer occur Q31= 0

and

AH

C,(T -Ts)=x 8.314 (300- 569.5)= -7842.18

mol

AU=C, (T¡-T)= x 8.314 (300

-5601.55

569.5)

mol

Now from first law of thermodynamie the Ws1

J

mol

AUs¡ = Ws¡ = -5601.55

3 0
3 years ago
A reversible process and an irreversible process both have the same________ between the same two states. a. Internal energy b. W
Vlad1618 [11]

Answer:

a) Internal energy

Explanation:

As we know that internal energy is a point function so it did not depends on the path ,it depends  at the initial and final states of process.All point function property did not depends on the path.Internal energy is a exact function.

Work and heat is a path function so these depend on the path.They have different values for different path between two states.Work and heat are in exact function.

We know that in ir-reversible process entropy will increase so entropy will be different for reversible and ir-reversible processes.

5 0
3 years ago
Jordan's dad made a new recipe for dinner. Jordan looked at the food and saw that it was white, yellow, and purple in color. She
zhenek [66]

Answer:

Jordan used her eyes to see the food, her touch to feel the food, and her nose to smell the food, and lastly, but most importantly, she used her mouth to taste the food.

7 0
2 years ago
Other questions:
  • You want to determine whether the race of the defendant has an impact on jury verdicts. You assign participants to watch a trial
    9·1 answer
  • You are to assess the biomechanics of a male’s arm using his bicep to hold a 20 kg object in his hand. The upper arm is perpendi
    5·1 answer
  • How an AK 47 gun was works​
    14·1 answer
  • Line(s) indicates passing is allowed if there are no oncoming cars.
    12·1 answer
  • Technician A says that most states will allow landfills to dispose of whole tires with a permit. Technician B says that landfill
    5·1 answer
  • A steady stream (1000 kg/hr) of air flows through a compressor, entering at (300 K, 0.1 MPa) and leaving at (425 K, 1 MPa). The
    10·1 answer
  • If fog is so bad that I can’t see for short distance what should I do
    9·2 answers
  • Orbit is to _____ as altitude is to _____.
    13·2 answers
  • 1 A power transmission includes a belt drive, a chain drive and a gear drive. Which of the following is the best arrangement bet
    5·1 answer
  • Give me top 5 British snacks
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!