Java Data Structure Cheat Sheet


Average time complexity of data structures:


Data structureAccess (top)Access (key)SearchInsertionDeletion
ArrayO(1)O(1)O(N)O(N)O(N)
StackO(1)O(N)O(N)O(1)O(1)
QueueO(1)O(N)O(N)O(1)O(1)
Linked ListO(1)O(N)O(N)O(1)O(1)
Hash Tablen/aO(1)O(1)O(1)O(1)
Binary Search TreeO(1)O(log N)O(log N)O(log N)O(log N)
HeapO(1)O(N)O(N)O(log N)O(log N)


Each link is for a Java example.


Comments

Popular posts from this blog

Minikube Installation for M1 Mac

Selenide: Quick Start

PyCharm: Quick Start