Inserts the new item to the heap. It takes O(log n) to insert, but also takes O(n) to copy the items.
O(log n)
O(n)
To insert.
The inserted new heap.
Inserts the new item to the heap. It takes
O(log n)to insert, but also takesO(n)to copy the items.