Upload
robinpt
View
213
Download
0
Embed Size (px)
DESCRIPTION
heapsort .ppt
Citation preview
Algorithm : insert_heap(item)n=n+1 //Add a new node to H ptr=n-1 // initialise ptr to the new node addedTREE[ptr]=item // find parent of the new nodewhile(ptr>0)parent =(ptr-1)/2if(TREE[ptr]>TREE [parent])Swap( TREE[ptr] and TREE[parrent] )// exchangeptr=parent // current position of the inserted nodeElse1. Break // no need to exchange,Endifendwhilestop
Algorithm : Delete _heap
**