Hardik Kamboj

Jun 03, 2025 • 3 min read

I Questioned the Linked List Browser Example, Here's What I Found!

I Questioned the Linked List Browser Example, Here's What I Found!

I was revisiting linked lists recently. It's nothing too groundbreaking, I'm just brushing up on the basics.

But this time, instead of just nodding along with the standard examples, I decided to question something that’s often just accepted at face value:

"Do browsers really use linked lists to manage history?"

It might sound like a small thing, but exploring that simple question led me to a few interesting insights. And it reminded me that sometimes,
curiosity > memorization.


The Classic Theory

If you've studied data structures, you've probably heard this:

“Browser history is like a doubly linked list. You can go forward and backward through visited pages.”

It sounds neat, right? Pages are dynamically added as you browse. You can click back, forward, and revisit pages, all operations that look a lot like traversing a linked list.

At first glance, this makes total sense, each node (page) links to the next and previous, and navigation feels like moving through a doubly linked list.

But…


Reality Check: What Do Browsers Actually Use?

After a bit of digging, I found that most modern browsers do NOT use linked lists for history.

Instead, they use:

  • Arrays

  • Sometimes custom objects

  • Plus a current index pointer

Here's how it works conceptually:

  • Every time you visit a new page, it’s pushed into an array.

  • If you navigate "back" and then visit a new page, the forward history is trimmed, and the new page is added at the end.

  • Your current page is tracked by a pointer (index) into the array.

This makes sense because arrays are:

  • Efficient (great with memory locality)

  • Predictable (no pointer overhead)

  • Fast (random access is trivial)

So while the behavior feels like a linked list, under the hood, it’s much more array-driven.


Why Not Linked Lists?

Here’s the key question:
If the logic seems like a linked list, why not use one?

Turns out, there are solid technical reasons:


Arrays are much better when you don’t need constant insertions or deletions in the middle. They shine for linear navigation with occasional back-and-forth, exactly how browsers work.


So, When Do Linked Lists Shine?

Linked lists aren't useless, far from it. They just excel in different places.

Here are 4 real-world use cases where linked lists are genuinely powerful:


🖼️ 1. Image Viewers

  • Easy to move to next/previous images

  • You can insert or remove slides dynamically

  • Doubly linked lists make "prev" and "next" pointers very intuitive


🎵 2. Music Playlists

  • Add/remove songs while something is playing?

  • Queue songs dynamically or skip around?

  • Linked lists make dynamic playlist updates smooth and fast.


🧠 3. OS Memory Management

  • Operating systems use free lists for managing memory blocks

  • Memory is often non-contiguous, and linked lists help track scattered chunks

  • You can split, merge, and coalesce memory blocks easily with a linked list


🌀 4. LRU (Least Recently Used) Caches

  • A doubly linked list + hashmap gives O(1) access and update time

  • Move accessed items to the front, remove the least recent from the back — perfect use case

  • This is the standard implementation in most LRU designs (like in browsers, ironically, but not for navigation)


🧵 TL;DR

  • Linked lists are great in theory and useful in specific scenarios.

  • But for something like browser history, an array with a pointer is simpler and faster.

  • Don’t blindly accept textbook examples as gospel. Implementation details vary wildly in the real world.

So next time someone says, “browsers use linked lists for history,” smile and say:

“Conceptually? Sure.
Real-world implementation? Probably not.”

And that’s a win for curiosity ✅

Join Hardik on Peerlist!

Join amazing folks like Hardik and thousands of other people in tech.

Create Profile

Join with Hardik’s personal invite link.

2

13

0