I am trying to implement a Heap defined Priority Queue, the algorithm is from CLRS book chapter 6. The pseudocode is listed below:
Max_Heap_Insert(A, key):
A.heap_size = A.heap_size + 1
A[A.heap_size] = -∞
Heap_Increase_Key(A, A.heap_size, key)
My question is that using python, how do I define -∞?
Python has special values float('inf')
and float('-inf')
.