The Gateway to Computer Science Excellence
0 votes
21 views
The operation HEAP-DELETE$(A, i)$  deletes the item in node $i$ from heap $A$. Give an implementation of HEAP-DELETE that runs in $O(lg\ n)$ time for an $n-$element max-heap.
in Algorithms by Boss (41.9k points) | 21 views

1 Answer

0 votes
Heap_Delete(A,i)

{

A[i] = A[A.heapsize]

A.heapsize--

Max_heapify(A,i)

}
by (45 points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,647 questions
56,497 answers
195,493 comments
100,826 users