The Gateway to Computer Science Excellence
0 votes
53 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 | 53 views

1 Answer

0 votes
Heap_Delete(A,i)

{

A[i] = A[A.heapsize]

A.heapsize--

Max_heapify(A,i)

}
by

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
52,345 questions
60,471 answers
201,797 comments
95,273 users