MaxHeap {Containers} | R Documentation |
This method instanciates class MaxHeap
.
aHeap = MaxHeap()
John Hughes
aHeap = MaxHeap() # Instanciate a MaxHeap. aHeap$insert(5) # Insert a few elements. aHeap$insert(3) aHeap$insert(4) aHeap$insert(1) aHeap$insert(6) aHeap$peekMax() # Inspect the maximum element. aHeap$removeMax() # Remove the maximum element. aHeap$peekMax() # Inspect the new maximum.