catskull.net

My Favorite Data Structure

Sam asked me what my favorite data structure is.1

Mine is the boolean2.

Sam said “That’s actually not a data structure.”3 I assume he’s correct. There is a single 4 year computer science university degree between us, and it does not bear my name - of that I’m sure!

However, I also know for a fact that he was not subjected to Brigham Young University’s Electrical and Computer Engineering 2220 “Fundamentals of Digital Systems” as I was.

Have you ever solved an n-dimensional truth table4 by hand? Have you ever enthusiastically submitted this photo as your homework while not even questioning for a moment your own sanity?

Good luck!
a photo of a monochrome green digital logic analyzer screen showing multiple waveforms

I say to you dear sir, give me your data structure and I will gladly build it out of boolean logic. Say a boolean is too primitive? Fine, I will use an array to represent a boolean value and I will implement my own array.

Boolean algebra5 is the most perfect system I’ve ever gazed into. I have only a tenuous grasp on it, as my transcript shows. However, there is truth represented in a truth table.

Good luck!
a screenshot of my college transcript

We live in a world that holds little regard for objectivity. It’s very hard to say anything is certain. Our brains are inside dark skulls with genetically evolved organs such as eyes, skin, ears, a tongue, a nose, and hair. These systems inform our brains of our environment. We developed them gradually over a few billion years, each generation being rewarded for informing their brains of environmental risks and rewards as a greater degree than the generation before, however minuscule. But we don’t know for certain that our perception of our environment is subjective to objective reality. We only really know that our perception is what allowed our ancestors to survive in their environment. Do we live in the same environment they did?

Boolean logic is not that. There is no question of statefulness, of truth. A bit is either “on” or “off”. We actually get to decide what “on” even means. It could literally be anything. A hole in a paper6. Actually, we’ve been storing data this way for longer than we’ve even technically had computers!7

Perhaps at some level, I find myself struggling to effectively communicate with others. Language seems to fail us, especially when we need it the most. So even if primitive, a boolean is my favorite data structure. It’s pure. And extremely versatile. We know what it means, it’s obvious.

So there you have it. My favorite data structure - the boolean. What’s yours?

  1. “My Favorite Data Structure” - samwarnick.com 

  2. Wikipedia - Boolean data type 

  3. Sam’s exact words were “Idk that I’m smart enough to say whether a Boolean is or isn’t a data structure. But probably not? A data value? 🤷🏻‍♂️” 

  4. Wikipedia - Truth table 

  5. Wikipedia - Boolean algebra 

  6. Wikipedia - Punched tape 

  7. Wikipedia - Jacquard machine 


1 Like