
Ask HN: Examples of data structures in real world examples - dglass
I&#x27;m familiar with most of the common data structures and how to implement them, but I still struggle with understanding how they&#x27;re used in real world situations. Obviously things like hash maps and queues are pretty common in a lot of codebases, but are there any examples of how data structures like linked lists and trees and stacks are used?<p>For what it&#x27;s worth, I&#x27;m mostly familiar with web apps so maybe they&#x27;re just not as common there.
======
cottonseed
Web apps examples: The children of a DOM node form a linked list, see
Node.{firstChild, lastChild, nextSibling, previousSibling}:

[https://developer.mozilla.org/en-
US/docs/Web/API/Node](https://developer.mozilla.org/en-US/docs/Web/API/Node)

What's more, the DOM form a tree: nodes have parents and children.

Stacks? Your programming language, whatever it is, uses a stack, the call
stack, to keep track of what functions are being called.

------
fiftyacorn
I ran a bigquery for java projects on github - was interesting to see the
majority of projects using ArrayList and HashMap. I mean i didnt drill down
into the datasets - but you could use a similar approach to see how structures
are used

------
dmlittle
Snapchat uses linked-listed to keep track of who you're going to send a snap
to.

Internet routers use queues to create a buffer of packets that have yet to be
processed.

Postgres uses trees or hashes to create table indices for faster queries.

Medium uses Bloom Filters to check if a user has read an article or not.

------
bsvalley
It's the difference between a programming language and its implementation. All
the things we manipulate as programmers these days are mostly high level.
Though, they are mostly made out of addresses and pointers in memory.

Example:

Array(API) = Linked List(Implementation) = address + pointers(Memory)

