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
Elza [17]
3 years ago
11

Consider an ordinary binary heap data structure with n elements that supports the instructions Insert and Extract-Min in O(log n

) worst- case time. Give a potential function Φ such that the amortized cost of Insert is O(log n) and the amortized cost of Extract-Min is O(1), and show that it works.
Mathematics
1 answer:
Ierofanga [76]3 years ago
7 0

Answer:

It has been proved from the explanation below that the amortized cost of Insert is O(log n) and the amortized cost of Extract-Min is O(1),

Step-by-step explanation:

First of all, let's look at what "Extra-min" does;

It does the following ;

- Extract the root, (O1) actual time

- Replaces it with the last element x in the heap and repair the heap down or up.

- It takes O (Logn) time which is the depth of the heap.

Now, to get O(1) amortized time for extra-min, the last element "x" must have enough potential for repairing the heap and this potential must be in order of its depth.

Since we have K elements and so the weight of the kth element is WK in the heap as it's depth. So we can say;

WK = log k - - - - - - - - - eq (1)

Thus, the potential function Φ of the heap Hn for the n elements can be defined as ΦHn = Σ(WK) for k = 1 up till n. And so ΦHn will surely be greater than 0.

Thus; ΦHn = n(Logn)

Now let's check for insert ;

- pay actual cost of insert (logn)

-raise potential of the new elements

Now, using extra-min; O(1) amortized. To repair the heap, we'll use the potential of log(n) for the last element x as mentioned earlier.

In summary, when we use insert, potential increases and this can be afforded by paying insert more while when extra-min, potential decreases by a right moment of the cost of repairing.

Thus, we clearly see that Insert is O(log n) amortized and Extract-Min is O(1) amortized.

You might be interested in
PLEASE ANSWER THIS IS WORTH SO MUCH
Ganezh [65]

Answer:

2.519

Step-by-step explanation:

<h3>area of the parallelogram=12.25 square centimeters is actually the area of the circle and we have a formula s=πr^{2} so r=3.5 centimeters. The formula of area of paralogram is s=b(base)h(height), we are looking for the value of height, so we have to work out the base and it acturallt is 8 times the rectangle's base, that is b=16r*sin10° then we use the area to devide the base and get the answer</h3>
5 0
3 years ago
Read 2 more answers
A discount airline sells a certain number of tickets, x, for a flight for $90 each. It sells the number of remaining tickets, y,
yKpoI14uk [10]

Answer:

x+y= 120

90x+250y=27,600

Step-by-step explanation:

x= number of certain tickets

y= number of remaining tickets

The statement indicates that for a particular flight the airline sold 120 tickets which means that the sum of the different tickets is 120. The first equation is:

x+y= 120

Then, the statement says that certain number of tickets costs $90 and the remaining tickets cost $250 and that for a particular flight, the airline collected $27,600. From this, you can say that the number of certain tickets, x, multiply for its price that is $90 plus the number of the remaining tickets, y, multiply for its price that is $250 would be equal to $27,600. The equation would be:

90x+250y=27,600

According to this, the answer is that the system of equations that represents this relationship between x and y is:

x+y= 120

90x+250y=27,600

7 0
4 years ago
Help finding the missing length
gulaghasi [49]

Answer:

4x2-6x+6

Step-by-step explanation:

(9x2-2x) +(3x-5)+(m) =13x2-5x+1

(13x2-5x+1)-(9x2+x-5)=m

3 0
3 years ago
Find the nonpermissible replacement for x in<br> this expression.<br> X-4/X-8
vitfil [10]

Answer:

8.

Step-by-step explanation:

x cannot be 8 because that would make the denominator zero.

8 0
4 years ago
. A painter mixes two and a half pints of yellow paint with 4 pints of red paint to make a certain shade of orange paint. How ma
spin [16.1K]

Answer:

6

Step-by-step explanation:

A painter mixes 2 1/2 pints (2.5 pints) of yellow paint with 4 pints of red paint to make a certain shade of orange paint. The ratio of yellow paint to red paint is 2.5:4. In order to find the pints of yellow paint needed to be mixed with 10 pints of red paint, we will use conversion fractions.

10 red pints × (2.5 yellow pints/ 4 red pints) ≈ 6 pints (we round off to 1 significant figure)

5 0
3 years ago
Other questions:
  • The slope of the line that contains the points (2, 11) and (0, 5 ) is 3. Which of the following equations represents this line?
    14·1 answer
  • K(x)=10x+5 inverse function
    12·1 answer
  • each month Kevin klog earns $1250 plus 0.8% of his sales last month his sales totaled $64,500. how much did Kevin earn?
    12·1 answer
  • Pls help me make you brainliest<br> 8:00 am in espanol please translate correctly
    9·2 answers
  • Decide whether 2x+8 and 2(x+4)+4 are equivalent expressions. Explain how you know
    8·1 answer
  • The campus cafeteria gives a 20% discount to students. If the group's dinner
    5·1 answer
  • -4(6x + 3) = -12<br> Help me if you want to : )
    15·1 answer
  • Ronique recorded the number of games that the school softball team won each year for the past 7 years: 31, 24, 32, 22, 34, 28, 3
    6·1 answer
  • PLEASE HELP PLEASE I WILL GIVE BRAINLIEST
    7·1 answer
  • Which polygon does not belong with the others?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!