Think Like A Programmer

Share this post

User's avatar
Think Like A Programmer
Binary Search Trees

Binary Search Trees

BowTiedHamachi's avatar
BowTiedHamachi
Dec 17, 2022
∙ Paid

Share this post

User's avatar
Think Like A Programmer
Binary Search Trees
Share

Hey guys, thanks so much for reading Think Like A Programmer where we break down complicated computer science concepts in bite-sized articles. In this week’s article, we’ll look at binary search trees - a useful data structure to filter and search for data in a convenient way.

Think Like A Programmer is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.

Before starting on today’s topic, I highly suggest looking at our previous articles on

  1. Arrays

  2. Linked Lists

Analogy

Ever tried finding a book in a unsorted bookshelf? It’s pretty hard to find anything at all if the books aren’t sorted out nicely at all.

Searching Got You GIF by grantkoltoons

Most times, you’ll need to sieve through the books one by one until you find what you’re looking for and if you happen to accidentally gloss over the book that you want - good luck starting from the top.

That’s why most bookshelves are sorted out in a alphabetical order - you have the books that start with an A before those that start with a Z.

What's the fastest way to alphabetize your bookshelf? - Chand John - YouTube

As we covered in our previous article on comparing algorithms, having an alphabetically ordered list of books means that we can reduce our search space.

Intuitively, If we’re looking for a book with a name that begins with a M, we’re not going to start looking for the book in the section with books that begin with Z.

Think Like A Programmer
Comparing Algorithms
Hello anon! It’s been a while since I announced the new paid Substack. Today’s drop marks the third paid article in our Substack. I’ve also added a 7 day free trial that will allow you to get access to the content below which will give you a quick glance at what is on the way…
Read more
3 years ago · BowTiedHamachi

What happens then as our collection of books gets larger and larger? Well, the most intuitive thing then is to simply start categorising collections according to subject. Each collection is then sorted alphabetically.

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2025 BowTiedHamachi
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share