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
What is the answer please help please
Brilliant_brown [7]

Answer:

86.9 cm^3

Step-by-step explanation:

You have to find the area of every face. Since the opposite sides have the same area, you can find three areas and then multiply by 2.

2(5.3x2)=21.2

2(4.5x2)=18

2(4.5x5.3)=47.7

You then add the values together...

21.2+18+47.7=86.9

7 0
3 years ago
Read 2 more answers
The legs of the drafting table form vertical angles. Find the measures of ∠1, ∠2 and ∠3.
Leviafan [203]

Answer:

m∡1 = 95°

m∡2 = 85°

m∡3 = 95°

Step-by-step explanation:

m∡1 + 85 = 180;   m∡1 = 95°

m∡2 = 85° because it is vertical and congruent to the angle measured 85°

m∡3 = m∡1 = 95° because they are vertical and congruent

4 0
3 years ago
Read 2 more answers
Find the distance between the points E(9,0) and F(0,-10) to the nearest tenth.
kobusy [5.1K]

Answer:

d \approx 13.5

General Formulas and Concepts:

<u>Pre-Algebra</u>

Order of Operations: BPEMDAS

  1. Brackets
  2. Parenthesis
  3. Exponents
  4. Multiplication
  5. Division
  6. Addition
  7. Subtraction
  • Left to Right

<u>Algebra II</u>

  • Distance Formula: d = \sqrt{(x_2-x_1)^2+(y_2-y_1)^2}

Step-by-step explanation:

<u>Step 1: Define</u>

Point E (9,0)

Point F (0, -10)

<u>Step 2: Find distance </u><em><u>d</u></em>

Simply plug in the 2 coordinates into the distance formula to find distance <em>d</em>.

  1. Substitute [DF]:                    d = \sqrt{(0-9)^2+(-10-0)^2}
  2. Subtract:                               d = \sqrt{(-9)^2+(-10)^2}
  3. Exponents:                           d = \sqrt{81+100}
  4. Add:                                      d = \sqrt{181}
  5. Evaluate:                              d = 13.4536
  6. Round:                                  d \approx 13.5
8 0
3 years ago
How would u do this problem ?? #9
Ad libitum [116K]
Since the scale factor is 4:3 then every dimension of triangle WXY is (3/4) of every dimension of triangle CDE.
The perimeter of triangle CDE = 13 + 22 + 29 = 64.
So, the perimeter of triangle WXY = (3/4) * 64 = 48


5 0
3 years ago
Last week, 22% of the campers at the state park were visiting from out of state . this week an additional 22% are from out of st
inessss [21]
22%+22% is 44%
175*44% is 77 campers from out of state this week
6 0
3 years ago
Other questions:
  • Please Help!
    11·2 answers
  • Simplify the expression.<br> 2(3y-7) - 52 - и
    13·2 answers
  • The value of x is both 5 times as much as the value of y and 36 more than the value y. I know the answer is 9. How can you solve
    8·1 answer
  • What is the y intercept f(x)=2×3^x
    11·1 answer
  • What’s:<br><br> X + 4 = -x - 4
    12·1 answer
  • Math...............math
    7·2 answers
  • PLEASE ANSWER ASAP FOR BRAINLEST SUPER EASY QUESTION!!!!!!!!!!!!!!!!!!!
    8·1 answer
  • Help please!! Branniest answer will be given!
    7·1 answer
  • Sixth grade &gt; H.5 Divide decimals by whole numbers: word problems TWZ
    11·2 answers
  • Evaluate (4/25) 1/2<br><br> A 4/5<br><br> B 4/25<br><br> C2/5<br><br> D2/25
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!