answer.
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
suter [353]
2 years ago
6

Outline an algorithm in **pseudo code** for checking whether an array H[1..n] is a heap and determine its time efficiency.

Engineering
1 answer:
svlad2 [7]2 years ago
3 0

Answer:

Condition to break: H[j] \geq max {H[2j] , H[2j+1]}

Efficiency: O(n).

Explanation:

Previous concepts

Heap algorithm is used to create all the possible permutations with K possible objects. Was created by B. R Heap in 1963.

Parental dominance condition represent a condition that is satisfied when the parent element is greater than his children.

Solution to the problem

We assume that we have an array H of size n for the algorithm.

It's important on this case analyze the parental dominance condition in order to the algorithm can work and construc a heap.

For this case we can set a counter j =1,2,... [n/2] (We just check until n/2 since in order to create a heap we need to satisfy minimum n/2 possible comparisionsand we need to check this:Break condition: [tex]H[j] \geq max {H[2j] , H[2j+1]}

And we just need to check on the array the last condition and if is not satisfied for any value of the counter j we need to stop the algorithm and the array would not a heap. Otherwise if we satisfy the condition for each j =1,2,.....,[n/2]p then we will have a heap.

On this case this algorithm needs to compare 2*(n/2) times the values and the efficiency is given by O(n).

You might be interested in
Initialize the tuple team_names with the strings 'Rockets', 'Raptors', 'Warriors', and 'Celtics' (The top-4 2018 NBA teams at th
Drupady [299]

Answer:

#Initialise a tuple

team_names = ('Rockets','Raptors','Warriors','Celtics')

print(team_names[0])

print(team_names[1])

print(team_names[2])

print(team_names[3])

Explanation:

The Python code illustrates or printed out the tuple team names at the end of a season.

The code displayed is a function that will display these teams as an output from the program.

4 0
2 years ago
The pump of a water distribution system is powered by a 6-kW electric motor whose efficiency is 95 percent. The water flow rate
Sonja [21]

Answer:

a) Mechanical efficiency (\varepsilon)=63.15%  b) Temperature rise= 0.028ºC

Explanation:

For the item a) you have to define the mechanical power introduced (Wmec) to the system and the power transferred to the water (Pw).

The power input (electric motor) is equal to the motor power multiplied by the efficiency. Thus, Wmec=0.95*6kW=5.7 kW.

Then, the power transferred (Pw) to the fluid is equal to the flow rate (Q) multiplied by the pressure jump \Delta P. So P_W = Q*\Delta P=0.018m^3/s * 200x10^3 Pa=3600W.

The efficiency is defined as the ratio between the output energy and the input energy. Then, the mechanical efficiency is \varepsilon=3.6kW/5.7kW=0.6315=63.15\%

For the b) item you have to consider that the inefficiency goes to the fluid as heat. So it is necessary to use the equation of the heat capacity but in a "flux" way. Calling <em>H</em> to the heat transfered to the fluid, the specif heat of the water and \rho the density of the water:

[tex]H=(5.7-3.6) kW=\rho*Q*c*\Delta T=1000kg/m^3*0.018m^3/s*4186J/(kg \ºC)*\Delta T[/tex]

Finally, the temperature rise is:

\Delta T=2100/75348 \ºC=0.028 \ºC

7 0
2 years ago
In which of the following branches of engineering is the practice not restricted?
fgiga [73]

Answer:

a) civil engineering.

Explanation:

Civil engineering is a professional engineering program that deals with the construction, design, and maintenance of all the natural and man-made environments including dams, buildings, railways, and roads.

Civil engineering is the branch of engineering that is the practice not restricted because civil engineer is not restricted to academic profession but practice in designing and construction can make someone a professional civil engineer.

Hence, the correct answer is "a)."

6 0
2 years ago
Read 2 more answers
An electric field is expressed in rectangular coordinates by E = 6x2ax + 6y ay +4az V/m.Find:a) VMN if point M and N are specifi
Fittoniya [83]

Answer:

a.) -147V

b.) -120V

c.) 51V

Explanation:

a.) Equation for potential difference is the integral of the electrical field from a to b for the voltage V_ba = V(b)-V(a).

b.) The problem becomes easier to solve if you draw out the circuit. Since potential at Q is 0, then Q is at ground. So voltage across V_MQ is the same as potential at V_M.

c.) Same process as part b. Draw out the circuit and you'll see that the potential a point V_N is the same as the voltage across V_NP added with the 2V from the other box.

Honestly, these things take practice to get used to. It's really hard to explain this.

3 0
2 years ago
The wires each have a diameter of 12 mm, length of 0.6 m, and are made from 304 stainless steel. Determine the magnitude of forc
Sonbull [250]

Answer:

Magnitude of force P = 25715.1517 N

Explanation:

Given - The wires each have a diameter of 12 mm, length of 0.6 m, and are made from 304 stainless steel.

To find - Determine the magnitude of force P so that the rigid beam tilts 0.015∘.

Proof -

Given that,

Diameter = 12 mm = 0.012 m

Length = 0.6 m

\theta = 0.015°

Youngs modulus of elasticity of 34 stainless steel is 193 GPa

Now,

By applying the conditions of equilibrium, we have

∑fₓ = 0, ∑f_{y} = 0, ∑M = 0

If ∑M_{A} = 0

⇒F_{BC}×0.9 - P × 0.6 = 0

⇒F_{BC}×3 - P × 2 = 0

⇒F_{BC} = \frac{2P}{3}

If ∑M_{B} = 0

⇒F_{AD}×0.9 = P × 0.3

⇒F_{AD} ×3 = P

⇒F_{AD} = \frac{P}{3}

Now,

Area, A = \frac{\pi }{4} X (0.012)^{2} = 1.3097 × 10⁻⁴ m²

We know that,

Change in Length , \delta = \frac{P l}{A E}

Now,

\delta_{AD} = \frac{P(0.6)}{3(1.3097)(10^{-4}) (193)(10^{9}  } = 9.1626 × 10⁻⁹ P

\delta_{BC} = \frac{2P(0.6)}{3(1.3097)(10^{-4}) (193)(10^{9}  } = 1.83253 × 10⁻⁸ P

Given that,

\theta = 0.015°

⇒\theta = 2.618 × 10⁻⁴ rad

So,

\theta =  \frac{\delta_{BC} - \delta_{AD}}{0.9}

⇒2.618 × 10⁻⁴ = (  1.83253 × 10⁻⁸ P - 9.1626 × 10⁻⁹ P) / 0.9

⇒P = 25715.1517 N

∴ we get

Magnitude of force P = 25715.1517 N

6 0
2 years ago
Other questions:
  • A_____ transducer is a device that can convert an electronic controller output signal into a standard pneumatic output. A. pneum
    13·1 answer
  • Water has a density of 1.94 slug/ft^3. What is the density expressed in SI units? Express the answer to three significant figure
    8·1 answer
  • Write multiple if statements: If carYear is before 1967, print "Probably has few safety features." (without quotes). If after 19
    6·1 answer
  • Consider a very long rectangular fin attached to a flat surface such that the temperature at the end of the fin is essentially t
    9·1 answer
  • The function below takes a single string parameter: input_string. If the input contains the lowercase letter z, return the strin
    15·1 answer
  • tech A says that a Hall-effect sensor can be used in an electronic ignition system. Tech B says that an optical-type sensor can
    6·1 answer
  • 2.31 LAB: Simple statistics Part 1 Given 4 integers, output their product and their average, using integer arithmetic. Ex: If th
    5·2 answers
  • Can crushers help us recycle in a space efficient way which is good for saving the earth and for giving you more room in your ap
    7·1 answer
  • An air standard cycle with constant specific heats is executed in a closed pistoncylinder system and is composed of the followin
    10·1 answer
  • A surface grinding operation is used to finish a flat plate that is 5.50 in wide and 12.500 in long. The starting thickness is 1
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!