Skip to content

Why Knowing HashMaps Won’t Make You a Better Engineer?

Every engineer should ask, which datastructure should I use to solve the problem. Base on experience and knowledge you can use the right one?

“Which data structure should I use?”

QuestionPattern
Data too big?Partition
Reads too slow?Index
Too many repeated reads?Cache
Continuous data?Stream
Need relationships?Graph
Need priority?Heap
Memory limited?Compress

Lets get to some details.

INDEX → “Find fast at scale”

Structures

  • B-Tree / B+ Tree
  • LSM Tree

Mental Model

“I don’t scan — I navigate”

Why it exists

Arrays & hashmaps break when:

  • Data is too large (disk)
  • Needs ordering + range queries

Real Systems

  • MySQL / PostgreSQL → B+ Trees
  • RocksDB / Cassandra → LSM Trees

PARTITION → “Split to scale”

Structures

  • Sharded Hash Maps
  • Distributed Hash Tables (DHT)

Mental Model

“One machine can’t handle it — split it”

Real Systems

  • Cassandra
  • DynamoDB
  • Kafka partitions

CACHE → “Trade memory for speed”

Structures

  • LRU Cache
  • LFU Cache

Mental Model

“Keep what matters close”

Real Systems

  • Redis
  • CDN caching
  • API response caching

STREAM → “Data never stops”

Structures

  • Ring Buffer
  • Log (append-only)

Mental Model

“Data is a flow, not a collection”

Real Systems

  • Kafka
  • Pulsar
  • Event streaming systems

PRIORITY → “Not everything is equal”

Structures

  • Heap
  • Fibonacci Heap

Mental Model

“Always process the most important first”

Real Systems

  • Job schedulers
  • Task queues
  • OS scheduling

GRAPH → “Relationships are everything”

Structures

  • Adjacency List / Matrix
  • Graph DB structures

Mental Model

“Connections matter more than data”

Real Systems

  • Neo4j
  • Social networks
  • Fraud detection

COMPRESS → “Do more with less”

Structures

  • Bloom Filter
  • HyperLogLog

Mental Model

“Be approximately right, but very fast”

Real Systems

  • Big data systems
  • Query optimization
  • Cardinality estimation