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
Water is the working fluid in an ideal Rankine cycle. The condenser pressure is 8 kPa, and saturated vapor enters the turbine at
sergeinik [125]

Explanation:

The obtained data from water properties tables are:

Point 1 (condenser exit) @ 8 KPa, saturated fluid

h_{f} = 173.358 \\h_{fg} = 2402.522

Point 2 (Pump exit) @ 18 MPa, saturated fluid & @ 4 MPa, saturated fluid

h_{2a} =  489.752\\h_{2b} =  313.2

Point 3 (Boiler exit) @ 18 MPa, saturated steam & @ 4 MPa, saturated steam

h_{3a} = 2701.26 \\s_{3a} = 7.1656\\h_{3b} = 2634.14\\s_{3b} = 7.6876

Point 4 (Turbine exit) @ 8 KPa, mixed fluid

x_{a} = 0.8608\\h_{4a} = 2241.448938\\x_{b} = 0.9291\\h_{4b} = 2405.54119

Calculate mass flow rates

Part a) @ 18 MPa

mass flow

\frac{100*10^6 }{w_{T} - w_{P}} = \frac{100*10^3 }{(h_{3a}  - h_{4a}) - (h_{2a}  - h_{f})}\\\\= \frac{100*10^ 3}{(2701.26  - 2241.448938 ) - (489.752  - 173.358)}\\\\= 697.2671076 \frac{kg}{s} = 2510161.587 \frac{kg}{hr}

Heat transfer rate through boiler

Q_{in}  = mass flow * (h_{3a} -  h_{2a})\\Q_{in} = (697.2671076)*(2701.26-489.752)\\\\Q_{in} = 1542011.787 W

Heat transfer rate through condenser

Q_{out}  = mass flow * (h_{4a} -  h_{f})\\Q_{out} = (697.2671076)*(2241.448938-173.358)\\\\Q_{out} = 1442011.787 W

Thermal Efficiency

n = \frac{W_{net}  }{Q_{in} } = \frac{100*10^3}{1542011.787}  \\\\n = 0.06485

Part b) @ 4 MPa

mass flow

\frac{100*10^6 }{w_{T} - w_{P}} = \frac{100*10^3 }{(h_{3b}  - h_{4b}) - (h_{2b}  - h_{f})}\\\\= \frac{100*10^ 3}{(2634.14  - 2405.54119 ) - (313.12  - 173.358)}\\\\= 1125 \frac{kg}{s} = 4052374.235 \frac{kg}{hr}

Heat transfer rate through boiler

Q_{in}  = mass flow * (h_{3b} -  h_{2b})\\Q_{in} = (1125.65951)*(2634.14-313.12)\\\\Q_{in} = 2612678.236 W

Heat transfer rate through condenser

Q_{out}  = mass flow * (h_{4b} -  h_{f})\\Q_{out} = (1125)*(2405.54119-173.358)\\\\Q_{out} = 2511206.089 W

Thermal Efficiency

n = \frac{W_{net}  }{Q_{in} } = \frac{100*10^3}{1542011.787}  \\\\n = 0.038275

6 0
3 years ago
A 1.5-kg specimen of a 90 wt% Pb-10 wt% Sn alloy (Animated Figure 9.8) is heated to 250°C; at this temperature it is entirely an
Alex17521 [72]

Answer:

A. By hit and trial method 280 C

Explanation:

ion know B sorry

6 0
2 years ago
A power plant operates on a regenerative vapor power cycle with one open feedwater heater. Steam enters the first turbine stage
ivolga24 [154]

Answer:

a. 46.15%

b. 261.73 kg/s

c. 54.79 kW/K

Explanation:

a. State 1

The parameters given are;

T₁ = 560°C

P₁ = 12 MPa = 120 bar

Therefore;

h₁ = 3507.41 kJ/kg,  s₁ = 6.6864 kJ/(kg·K)

State 2

p₂ = 1 MPa = 10 bar

s₂ = s₁ = 6.6864 kJ/(kg·K)

h₂ = (6.6864 - 6.6426)÷(6.6955 - 6.6426)×(2828.27 - 2803.52) + 2803.52

= (0.0438 ÷ 0.0529) × 24.75 = 2824.01 kJ/kg

State 3

p₃ = 6 kPa = 0.06 bar

s₃ = s₁ = 6.6864 kJ/(kg·K)

sg = 8.3291 kJ/(kg·K)

sf = 0.52087 kJ/(kg·K)

x = s₃/sfg = (6.6864- 0.52087)/(8.3291  - 0.52087) = 0.7896

(h₃ - 151.494)/2415.17 = 0.7896

∴ h₃ = 2058.56 kJ/kg

State 4

Saturated liquid state

p₄ = 0.06 bar= 6000 Pa, h₄ = 151.494 kJ/kg, s₄ = 0.52087 kJ/(kg·K)

State 5

Open feed-water heater

p₅ = p₂ =  1 MPa = 10 bar = 1000000 Pa

s₄ = s₅ = 0.52087 kJ/(kg·K)

h₅ = h₄ + work done by the pump on the saturated liquid

∴ h₅ = h₄ + v₄ × (p₅ - p₄)

h₅ = 151.494 + 0.00100645 × (1000000 - 6000)/1000 = 152.4944113 kJ/kg

Step 6

Saturated liquid state

p₆ = 1 MPa = 10 bar

h₆ = 762.683 kJ/kg

s₆ = 2.1384 kJ/(kg·K)

v₆ = 0.00112723 m³/kg

Step 7

p₇ = p₁ = 12 MPa = 120 bar

s₇ = s₆ = 2.1384 kJ/(kg·K)

h₇ = h₆ + v₆ × (p₇ - p₆)

h₇ = 762.683  + 0.00112723 * (12 - 1) * 1000 = 775.08253 kJ/kg

The fraction of flow extracted at the second stage, y, is given as follows

y = \dfrac{762.683 - 152.4944113 }{2824.01 - 152.4944113 } = 0.2284

The turbine control volume is given as follows;

\dfrac{\dot{W_t}}{\dot{m_{1}}} = \left (h_{1} - h_{2}  \right ) + \left (1 - y  \right )\left (h_{2} - h_{3}  \right )

= (3507.41  - 2824.01) + (1 - 0.22840)*(2824.01 - 2058.56) = 1274.02122 kJ/kg

For the pumps, we have;

\dfrac{\dot{W_p}}{\dot{m_{1}}} = \left (h_{7} - h_{6}  \right ) + \left (1 - y  \right )\left (h_{5} - h_{4}  \right )

= (775.08253 - 762.683) + (1 - 0.22840)*(152.4944113 -  151.494)

= 13.17 kJ/kg

For the working fluid that flows through the steam generator, we have;

\dfrac{\dot{Q_{in}}}{\dot{m_{1}}} = \left (h_{1} - h_{7}  \right )

= 3507.41 - 775.08253 = 2732.32747 kJ/kg

The thermal efficiency, η, is given as follows;

\eta = \dfrac{\dfrac{\dot{W_t}}{\dot{m_{1}}} -\dfrac{\dot{W_p}}{\dot{m_{1}}}}{\dfrac{\dot{Q_{in}}}{\dot{m_{1}}}}

η = (1274.02122 - 13.17)/2732.32747 = 0.4615 which is 46.15%

(762.683 - 152.4944113)/(2824.01 - 152.4944113)

b. The mass flow rate, \dot{m_{1}}, into the first turbine stage is given as follows;

\dot{m_{1}} = \dfrac{\dot{W_{cycle}}}{\dfrac{\dot{W_t}}{\dot{m_{1}}} -\dfrac{\dot{W_p}}{\dot{m_{1}}}}

\dot{m_{1}} = 330 *1000/(1274.02122 - 13.17) = 261.73 kg/s

c. From the entropy rate balance of the steady state form, we have;

\dot{\sigma }_{cv} = \sum_{e}^{}\dot{m}_{e}s_{e} - \sum_{i}^{}\dot{m}_{i}s_{i} = \dot{m}_{6}s_{6} - \dot{m}_{2}s_{2} - \dot{m}_{5}s_{5}

\dot{\sigma }_{cv} = \dot{m}_{6} \left [s_{6} - ys_{2} - (1 - y)s_{5}  \right ]

= 261.73 * (2.1384 - 0.2284*6.6864 - (1 - 0.2284)*0.52087 = 54.79 kW/K

4 0
3 years ago
Relationship between civil engineering and geology​
natka813 [3]

Answer:

Geological and civil engineers sometimes work together, but have very different responsibilities. While geological engineers study the earth's inner and outer surface to evaluate potential mining and infrastructure construction sites, civil engineers design the infrastructure to be built.

5 0
3 years ago
Giải giúp mình câu này được không ạ.em cảm ơn
sp2606 [1]

Answer:

çâdßèöñbvjsjaushdhshs

4 0
3 years ago
Other questions:
  • 10 kg/s Propane at 10 bar and 20 C is directed to an adiabatic rigid mixer and is mixed with 20 kg/s Propane at 10 bar and 40 C.
    11·1 answer
  • PLEASE HELP ME ASAP AND PLEASE answer correctly. If I said that it is 70 degrees Fahrenheit today (21 degrees Celsius), is that
    12·2 answers
  • You just purchased a 400-L rigid tank for a client who works in the gas industry. The tank is delivered pre-filled with 3 kg of
    8·1 answer
  • A mass of 12 kg saturated refrigerant-134a vapor is contained in a piston-cylinder device at 240 kPa. Now 300 kJ of heat is tran
    8·1 answer
  • Looking for new information is one reason you should do research for a speech.
    15·2 answers
  • Reusable refrigerant containers under high-pressure must be hydrostatically tested how often?
    10·1 answer
  • Assuming two open reservoirs are at an elevation of 510’ and 955’ above mean sea level, and separated by a distance of 3.5 miles
    15·1 answer
  • If you are interested only in the temperature range of 20° to 40°C and the ADC has a 0 to 3V input range, design a signal condit
    10·1 answer
  • What conclusions can you reach from your gym teacher’s science-fair display?
    13·1 answer
  • Liquid water at 300 kPa and 20°C is heated in a chamber by mixing it with superheated steam at 300 kPa and 300°C. Cold water ent
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!