Skip to main content

Command Palette

Search for a command to run...

πŸ”— Linked Lists Explained Like You're 5

Published
β€’2 min read
S

Building AI systems and writing about how they actually work. Master of AI @ University of Technology Sydney. Previously B.Tech CS with focus on IoT. I believe the best way to learn is to explain. That's why I'm documenting tech concepts with simple analogies (@sreekarreddy.com). AWS Certified β€’ Azure AI Certified β€’ Neo4j Professional β€’ Google Data Analytics When not coding: exploring Sydney, working on side projects, and teaching tech to anyone who'll listen.

Treasure hunt clues pointing to next

Day 35 of 149

πŸ‘‰ Full deep-dive with code examples


The Treasure Hunt

Each clue tells you where the next clue is:

Clue 1: "Go to the park" β†’
Clue 2: "Look under the bench" β†’
Clue 3: "Check the fountain" β†’
Treasure! 🎁

Each clue POINTS to the next one!

Linked lists work the same way!


Arrays vs Linked Lists

Array: Line of lockers next to each other

[A][B][C][D][E]

Want to insert between B and C? You often end up moving a bunch of items!

Linked List: Each item points to the next

A β†’ B β†’ C β†’ D β†’ E β†’ null

Insert between B and C? Just change pointers!


The Trade-off

OperationArrayLinked List
Access by indexFast!Slower (you often walk through)
Insert/deleteSlow (shift elements)Fast!

When to Use

  • Lots of insertions/deletions? β†’ Linked list
  • Random access by index? β†’ Array

In One Sentence

Linked lists store data in nodes where each node points to the next, making insertions easy but direct access slow.


πŸ”— Enjoying these? Follow for daily ELI5 explanations!

Making complex tech concepts simple, one day at a time.

More from this blog

esreekarreddy

132 posts