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 volume of the prism?
Dmitry [639]
The volume would be 2040
7 0
3 years ago
13 Create trig ratios to solve for the variables. Round your answer to one decimal place: 8 cm ms y 50° x= y​
vovangra [49]

Answer:

Step-by-step explanation:

Ifk

4 0
3 years ago
At 11560 ft above sea level climax Colorado is the highest town in the USA. The lowest town is calipatria, California at 185 ft
Ugo [173]
The first integer is 11560 and the other one is -185 Calipatria is 11375 feet closer to sea level Please mark as brainliest if you like my answer :D
3 0
3 years ago
Read 2 more answers
If I sent out 200 letters and got 80 responses. If I want 20 more responses how many more letters do I have to send out
yawa3891 [41]

Answer:

Step-by-step explanation:

50

7 0
3 years ago
What is the area of the triangle? 5 in. 3 in 4in O 6 square inches O 7-square inches O 10 square inches O 12 square ches ​
WARRIOR [948]

Answer:

-------------------Heya Kjowanpreet!--------------

\large{ \tt{ \star\: S \: O \: L \: U \: T \: I \: O \: N : }}

GiveN :

  • Sides of the triangle : 3 in , 5 in and 4 ft

To FinD :

  • Area of the provided right angled triangle

FormulA :

  • Area of right angled triangle = 1/2 b × p where b = base & p = perpendicular. Here , Perpendicular = 3 in and base = 4 in

SolvinG :

\large{ \boxed{ \bf{Area \: of \:right \: angled \: triangle : \frac{1}{2} b \times p  }}}

\longrightarrow{  \tt{} \frac{1}{2}  \times 3 \times 4}

\longrightarrow{ \boxed{ \tt{6 \: in ^{2} }}}

  • Yay ! Finally , We solved. Our final answer is 6 square inches.

-------------HappY LearninG <3 ---------------

8 0
2 years ago
Read 2 more answers
Other questions:
  • The sum of 12 and the quantity 8 times a number k is equal to 48
    9·1 answer
  • A colony of ants carried away 14 of your muffins that was 2/3 of all of them how many are left
    10·2 answers
  • Consider the following function:y=1/(x+5)+2
    7·2 answers
  • A store purchased a DVD for $12.00 and sold it to a customer for 50% more than the purchase price. The customer was charged a 7%
    8·2 answers
  • Solve this equation a{6a-2a}=b{2a-3b}
    13·1 answer
  • I need help with this please
    12·1 answer
  • 40 + 2b3 when<br> b = 5 and c= 1.2
    8·1 answer
  • porsha owns 15% of Kenya Moore hair care. the rest of the shares are owned by the remainder of her friends, Kandi, Cynthia, Eva,
    11·1 answer
  • Algebra 1
    15·1 answer
  • a) Students returning to a secondary school have to pass through a check point at the rate of 50 per though. The average time fo
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!