Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Suppose there is now way to represent the key - infinity . Rewrite the BINOM-HP-DEL procedure to work correctly in this situation. It should still
Suppose there is now way to represent the key - infinity. Rewrite the BINOM-HP-DEL procedure to work correctly in this situation. It should still take O(lg n) steps. Dos it?
(please write down each step in detail)
(this question from "introduction to algorithm 2nd version 19.2-6)
(Hint:
Binomial-Heap-Delete(H,x) Binomial-Heap-Decrease-Key(H,x,-infinity) Binomial-Heap-Extract-Min(H)
============================================= Binomial-Heap-Extract-Min(H) find the root x with the minimum key in the root list of H, and remove x from the root list of H H' := Make-Binomial-Heap() reverse the order of the linked list of x's children and set head[H'] to point to the head of the resulting list H := Binomial-Heap-Union(H,H') return x =================================================== Binomial-Heap-Decrease-Key(H,x,k) if k > key[x] then error "hew key is greater than current key" key[x] := k y := x z := p[y] while z <> NIL and key[y] < key[z] do exchange key[y] and key[z] if y and z have satellite fields, exchange them, too. y := z z := p[y] )
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started