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]
2 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]2 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
Find the area of the composite shape. Pls help due tomorrow
Andrej [43]
The area of the composite shape is 203ft

4 0
2 years ago
What is 2.75 rounded to the nearest hundredth
almond37 [142]
Well first off we need to know how to round or what rounding is. Rounding is the approximation of numbers usually decimals to a approximate cut off number for numbers that are too long or hard to work with/remember. To round a number you simply need to look at the number behind that number whether its a whole number (integer) or a decimal, either one will work. Now continuing on (on) how to round the number, look at the number after it and if it is 5 or above the number rounds up +1 and all numbers behind that turn to 0. For example 3.25500 round to the nearest hundredth, 3.26(000). Now if the number is 4 or smaller then you don't do anything at all (no rounding) and all the numbers after the being rounded number turn to 0's like so, 3.254(0000) rounded to the nearest hundredth, 3.25(00000). So now that we know how to round and what rounding is we need to look at are hundredth place on are number here and see what the next number is after that, in this case it is 0 because there is no stated number there the default next number is 0 like so,
2.750 and because 0 is under 5 we don't do any rounding at all here and just leave it as it is. So 2.75 rounded to the nearest hundredth is 2.75

Enjoy!=)
4 0
3 years ago
Which equation should be used to calculate the 43rd partial sum for the arithmetic sequence.
MariettaO [177]

Answer: First Option : Sₙ= n/2(a₁ + aₙ)

Step-by-step explanation:

The nth partial sum of an arithmetic sequence or the sum of the first n terms of the arithmetic series can be defined as the sum of a finite number of term in an arithmetic sequence.

It is calculated using the formula:

Sₙ= n/2(a₁ + aₙ)

Where :

a₁ = First term

aₙ = last term

n = number of terms

6 0
2 years ago
A change purse contains an equal number of pennies, nickels, and dimes. The total value of the coins is 208
Aliun [14]

Answer:

x= 14

Step-by-step explanation:

x + 5x +10x = 224 CENTS

solving for x

16x = 224

x = 14, the number of each coin there is

5 0
3 years ago
What is significant about circles that provides us with an equilateral triangle?
Ipatiy [6.2K]

Answer:

The circle is important when constructing equilateral triangles because it can allow one to draw an accurate triangle while not having a ruler to measure it out.

Step-by-step explanation:

7 0
2 years ago
Other questions:
  • What is this number in standard form? (8×10)+(2×1/100)+(9×11/,000)
    10·1 answer
  • What's the greatest common factor of 129 and 86
    13·1 answer
  • The quotient 600÷2/3 tells about how far a tortoise may move in one hour. find that distance
    10·2 answers
  • (- 5x³77) ²<br> Can someone Simply this answer
    15·1 answer
  • Graph the circle 2+ y2 - 14x + 2y + 41 = 0.
    12·2 answers
  • the scatterplot below shows the history test score and the math test score for each student in mr. phillips homeroom.
    7·1 answer
  • I need help quickly please can someone help
    8·1 answer
  • What is the reciprocal of 3 1/8
    11·1 answer
  • There’s 2 answer options
    14·1 answer
  • Find the shaded area
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!