Python Data Structures
| Operation | list | dict | set | deque |
|---|---|---|---|---|
| Access by index | O(1) | N/A | N/A | |
| Search | O(N) | O(1) avg | O(1) avg | |
| Insert at end | O(1) amortized | O(1) amortized | O(1) amortized | |
| Insert at front | O(N) | N/A | N/A | |
| Delete by key | O(N) | O(1) avg | O(1) avg | |
| Membership test | O(N) | O(1) avg | O(1) avg |
Go Data Structures
| Operation | slice | map | channel (buffered) |
|---|---|---|---|
| Access by index | O(1) | O(1) avg | |
| Insert at end (append) | O(1) amortized | O(1) amortized | |
| Delete by key | O(N) shift | O(1) avg | |
| Range (for-range) | O(N) | O(N) |
Database Operations
| Operation | Complexity | Condition |
|---|---|---|
| Point lookup | O(log N) | |
| Point lookup (no index) | O(N) | |
| Range scan | O(log N + K) | |
| Sort result set | O(N log N) | |
| JOIN (hash join) | O(N+M) | |
| JOIN (nested loop) | O(N×M) | |
| INSERT | O(log N) | |
| UPDATE with index | O(log N) update + O(log N) index |
Redis Operations
| Command | Complexity | Notes |
|---|---|---|
| GET/SET | O(1) | |
| MGET/MSET | O(N) | |
| HGET/HSET | O(1) | |
| HGETALL | O(N) | |
| LPUSH/RPUSH | O(1) | |
| LRANGE | O(S+N) | |
| ZADD | O(log N) | |
| ZRANGE | O(log N + K) | |
| KEYS pattern | O(N) | |
| SCAN | O(1) per call, O(N) total |
HTTP / Network
| Item | Value |
|---|---|
| TCP 3-way handshake | |
| TLS 1.3 handshake | |
| TLS 1.2 handshake | |
| DNS lookup (uncached) | |
| HTTP/1.1 request | |
| HTTP/2 request | |
| gRPC (over HTTP/2) |