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
suter [353]
4 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]4 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
For this question, you will be provided with data related to the count of website sessions by day for the past one hundred days.
svet-max [94.6K]

Answer: Idk

Explanation:

6 0
3 years ago
Sarah and Raj take/takes me to a baseball game every year.
timofeeve [1]

Answer:

take

play

are

sits

crouches

direct

indirect

direct

direct

indirect

Explanation:

i had just taken the test

4 0
3 years ago
Consider a circuit element, with terminals a and b, that has vab= -12V and iab= 3A. Over a period of 2 seconds, how much charge
miv72 [106K]

Answer:

a) 6 coulombs

b) The electrons carrying the charge will enter at point b with respect to element and this is because electrons follow in opposite direction of current

c) = -72 joules

Energy is taken from element

Explanation:

Given data:

V ab = -12 v

I ab = 3A

period ( t ) = 2 seconds

a) determine how much charge moves through the element

q = I * t

  = 3 * 2 = 6 coulombs

b) The electrons carrying the charge will enter at point b with respect to element and this is because electrons follow in opposite direction of current

c) determine how much energy is transferred

= Vab * Iab * t

= -12 * 3 * 2

= -72 joules

Energy is taken from element

5 0
3 years ago
As you push a toggle bolt into a wall, the
MakcuM [25]
Answer:

Explanation:
One the object is attached the toggle it's placed onto the bolt. The wings should be open in the direction of the bolt head. The toggle is than collapsed and the entire toggle bolt is inserted into the hole in the wall. Once the wings are fully through the opening they will spring open on the other side.
Hopt it's help thanks..

5 0
2 years ago
Air is compressed by a 30-kW compressor from P1 to P2. The air temperature is maintained constant at 25°C during this process as
adell [148]

Answer:

-0.1006Kw/K

Explanation:

The rate of entropy change in the air can be reduced from the heat transfer and the air temperature. Hence,

ΔS = Q/T

Where T is the constant absolute temperature of the system and Q is the heat transfer for the internally reversible process.

S(air) = - Q/T(air) .......1

Where S.air =

Q = 30-kW

T.air = 298k

Substitute the values into equation 1

S(air) = - 30/298

= -0.1006Kw/K

4 0
3 years ago
Other questions:
  • The natural variation of a process relative to the variation allowed by the design specifications is known as
    15·1 answer
  • A cylindrical bar of steel 10.1 mm (0.3976 in.) in diameter is to be deformed elastically by application of a force along the ba
    15·1 answer
  • What does basic levels of competence involves??​
    13·2 answers
  • 5.5 A scraper with a 275 hp diesel engine will be used to excavate and haul earth for a highway project. An evaluation of the jo
    10·1 answer
  • A 6-pole, 50 Hz squirrel cage induction motor has rotor resistance and standstill reactance referred to stator of 0.2 ohm and 1
    7·1 answer
  • How does an engine convert fuel into a useful form of energy
    6·1 answer
  • How long does it take electrons to get from a car battery to the starting motor? Assume the current is 300 A and the electrons t
    10·1 answer
  • A moving-coil instrument, which gives full-scale deflection with 0.015 A has a copper coil having resistance of 1.5 Ohm at 15°C
    7·1 answer
  • How long will it take a Honda Civic to travel 118 miles if it is travelling at an average speed of 72 mph?
    6·1 answer
  • Explain your own understanding about the relevant connections between the four subsystems of Earth through the use of a creative
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!