a binary tree where the smallest value is always on the top. used to implement a *priority queue or heap sort
Heap | avarage | worst |
---|---|---|
Get Min | O(1) | O(1) |
Remove Min | O(log(n)) | O(log(n)) |
Insertion | O(1) | O(log(n)) |
Heapsort | O(1) | O(n*log(n)) |
Heapify | O(n) | O(n) |
Space | O(n) | O(n) |
insertion
search
deletion
inorder traversal
Inorder traversal can be used to sort the binary tree
preorder traversal
preorder Traversal can be used to copy the binary tree
postorder traversal
postorder Traversal can be used to delete the binary tree