Algorithm 3 D-ary Heap Insert and Increase Key

1:procedure D-MaxHeapInsert(A,keyA, key)

2:A.heap-size=A.heap-size+1A.\text{heap-size} = A.\text{heap-size} + 1

3:A[A.heap-size]=A[A.\text{heap-size}] = -\infty

4:D-HeapIncreaseKey(A,A.heap-size,keyA, A.\text{heap-size}, key)

5:end procedure

6:

7:procedure D-HeapIncreaseKey(A,i,keyA, i, key)

8:if key<A[i]key < A[i] then

9:error "new key is smaller than current key"

10:end if

11:A[i]=keyA[i] = key

12:while i>1i > 1 and A[A[D-Parent(ii)]<A[i]] < A[i] do

13:exchange A[i]A[i] with A[A[D-Parent(ii)]]

14:i=i = D-Parent(ii)

15:end while

16:end procedure