Skip to content

Instantly share code, notes, and snippets.

@evidanary
Created June 16, 2017 21:57
Show Gist options
  • Save evidanary/e75798118d58ec1481bd0bc69a658d4f to your computer and use it in GitHub Desktop.
Save evidanary/e75798118d58ec1481bd0bc69a658d4f to your computer and use it in GitHub Desktop.
#######################
Time complexities
#######################
Priority Queue (Binary Heap) / Max Heaps or Min Heaps:
top: O(1), pop: O(logn), add: O(logn), build: O(nlogn), Delete Random: logn if have pointer to element, N otherwise
API: remove, peek, pop, add, size
Priority Queue (Fibonacci Heap):
top: O(1), pop: O(logN), add: O(1), build: O(nlogn), ?Delete Random: logn if have pointer to element, N otherwise
BST:
search: O(1), min/max: O(logn), insert: O(logn), build: O(nlogn)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment