# NOT RUN {
# Create a sample data frame
heap <- data.frame(keys=c(0,3,4,5), vals=c(7,7,4,6))
# Build the heap from the data frame.
heap <- build_heap(heap)
# Call max-heapify untill the last node
i = floor(nrow(heap)/2)
while (i>=1){
heap = max_heapify(heap, i, nrow(heap))
i = i-1
}
# }
Run the code above in your browser using DataLab