This article was republished from Books on Code.
There is a book --- a book with cute illustrations and diagrams of cartoon animals --- that allowed me to ace a notoriously-difficult class of computer science core curriculum.
I aced Data Structures & Algorithms.
Because of cartoon animals!
You may be thinking, "That's preposterous!" And that's okay. I have boring friends who still think that textbooks need to be boring to be 'serious' and 'academic'. But this is Books on Code. At Books on Code, we talk about books on code --- and they're not boring.
"But why?" You might ask. "Are you sure you weren't just being sensational and click-baity?"
I am indeed not being sensational. So let's jump right into this book and allow me to divulge the secrets that thwart any computer science woes.
Overview
Grokking Algorithms by Aditya Y Bhargava is, on the surface, a text that teaches classic data structure and algorithm topics. But the book has a catch: it's a joy to read! So much so that I read it for fun before even taking an algorithms class.
The following is a list of many of the topics this book covers:
Binary search
Big O notation
Arrays and linked lists
Selection sort
Recursion
Stacks
Quicksort
Hash tables
Breadth-first search,
Dijkstra's algorithm
Greedy algorithms
Dynamic programming
K-nearest neighbors
Trees
The SHA algorithm
And more!
All of these topics might sound overwhelming and a bit scary for a book with cartoon animal illustrations (and "joy," as I put it). Also, this book isn't very long --- hovering at around 200 pages.
You may have noticed recursion in the list of topics, which is a mind-bendy concept when first introduced. What if I told you this book explains recursion to complete understanding in about five pages?
3 Learning Secrets
There's a reason this book is so effective at teaching, and these sections explain exactly why.
Learning Secret #1: Illustrations of Cartoon Animals are Novel
It turns out that cute illustrations are novel. Bringing in that element of the unexpected --- along with plain good technical writing --- made Grokking Algorithms a joy to read.
If you've read my previous January Book Haul post, you know that I am obsessed with the Head First series by O'Reilly Media. Every first chapter of a Head First book describes the importance of novelty in learning.
In my free email course,Get the Most from Technical Books (For Programmers), I tell my students don't read bad technical books. They should instead be looking for the book with the mouse drawings, since that book understands that textbooks are meant for learning more than for sleeping.
Because each Head First book explains it so well, I'm just going to put the whole section here:
Your brain craves novelty. It's always searching's scanning, waiting for something unusual. It was built that way, and it helps you stay alive.
So what does your brain do with all the routine, ordinary, normal things you encounter? Everything it can to stop them from interfering with the brain's real job --- recording things that matter. It doesn't bother saving the boring things; they never make it past "this is obviously not important" filter.
How does your brain know what's important? Suppose you're out for a day hike and a tiger jumps in front of you --- what happens inside your head and body?
Neurons fire. Emotions crank up. Chemicals surge.
And that's how your brain knows...
This must be important! Don't forget it!
So there you have it: how cute cartoons can get you an A in your Data Structures class.
Learning Secret #2: The Illustrations Are Optimized for Your Brain
It's really not just the illustrations. It's the writing and the illustrations.
If you have taken any college writing class, you may have been assigned Elements of Style, commonly referred to by the authors, "Strunk & White".
This is its most famous rule:
Omit needless words.
Vigorous writing is concise. A sentence should contain no unnecessary words, a paragraph no unnecessary sentences, for the same reason that a drawing should have no unnecessary lines and a machine no unnecessary parts.
I bring this up because I want you to note both the words and the illustrations in the following excerpt from Grokking Algorithms. Click the images to see a larger view:
This section is telling a story: it sets the scene ("you go to a show and need to check your things") and presents an image, marking each step of the narrative.
Notice the details presented in the illustrations. The text is clean and specific, yet the illustrations show humor.
A handful of novel details that keep my interest:
The fancy frills on the chest of drawers. These drawers have elevated value. Also just the strangeness of the idea of checking things into a set of drawers.
The man in a funny mustache and bow tie who opens the drawers and uses the formal French address 'monsieur'.
The man in the funny spotted turtleneck sweater, requesting the number of drawers.
The drawers store an umbrella (a practical item) and a bunny (an impractical item!).
The bunny's position in the drawer and its expression! 😂
By the time we get to the final illustration, we see the chest of drawers from another angle, but now it resembles what we would traditionally see in an explanation of memory in a computer science course: a grid of squares, and a label of the computer-generated address.
While this explanation of memory takes little real estate in the book, it conveyed a lot: it gives its readers a visual mental model of memory that sticks.
Learning Secret #3: It Talks Directly To You
Have you watched the show for preschool children, Blue's Clues? According to Wikipedia, it "has been described as the first commercial television show for preschoolers that was both educational and profitable." It's mind-blowing that an educational show for preschoolers had massive popularity like that, and it even got a reboot in 2019.
The stuff in Blues Clue's was revolutionary and that's because it was both educational and fun. It was conversational and spoke directly to 'you', asking questions without ever talking down --- even though the audience was composed of 5 year olds.
When I was in high school, I wanted to be a children's book author.
I found a successful children's book author to mentor me, and he took me to the book store and taught me how to read children's books critically. Like he taught me to, I spent plenty of time in the children's book sections of bookstores trying to deconstruct them in my head.
But my interests weren't always understood by my peers. It seemed that because I was actively reading and emulating the simple language of books geared toward children, I was portraying an immature intellect myself.
But a Master of Arts in literature and a career in enterprise software later --- I still haven't outgrown my "children's book phase." Children's literature has a thing that is universally appealing, and it normally takes until parenthood for adults to discover this.
This is what I think: we have spent decades perfecting education and entertainment for children, but what we got right for children we are not yet getting right for adults.
Think about it: our mechanisms for learning are just the same as for small children. Children are master learners, and while what we strive to learn is far more complex than that of children, how we learn is innate. We ought to embrace what children's education can teach us about adult education.
I am not saying that Grokking Algorithms is a children's education book, but it uses educational tools that we more frequently find in children's literature than we find in adult texts.
Referencing the excerpt from the previous section, you notice that the text is speaking to 'you' and it is instructing 'you' to walk through those steps.
The book also asks tons of questions. Here is just a sample of them:
Every day, you write down everything you spent money on. At the end of the month, you review your expenses and sum up how much you spent. So, you have lots of inserts and few reads. Should you use an array or a list?
Suppose you have a bunch of music on your computer. For each artist, you have a play count.
You want to sort this list from most to least played, so that you can rank your favorite artists. How can you do it?
Suppose you're running a voting booth. Naturally, every person can vote just once. How do you make sure they haven't voted before?
Each of the examples are easy to grasp and practical. And while I didn't include them here, they are often accompanied by an illustration. The questions often have some form of a natural separator, whether that be a page turn, a transition to a new section, or an illustration.
Because the book has so many 'beats' --- lots of line breaks, illustrations, and section headers --- it's easy to slow down and think with the book, as if you're having a real conversation.
Review Snapshot
This review snapshot covers all the basics you need to understand about this book: the audience that suits this book best, its affordability, how much value the book brings, and most importantly, how fun the book is to read. Since after all, books on programming ought to be fun to read.
Main Audience: "Beginning Coder"
You've taken an introduction to programming course or are self-taught in programming concepts such as variables and conditionals. That, or you did already take a data structure & algorithms course, but the material flew by and you're not sure if you actually learned it (and don't be shy if you're in this camp; I know plenty of people who are). This book is great for first-time learners or those looking for a review.
Affordability Score: "Cheaper than the Average Textbook"
As of this writing, Grokking Algorithms on Amazon is $36 USD, cut from the retail price of $45. This book has the benefit of being on the market for awhile, so there's plenty of used and library copies as well.
As a consequence of my academic discipline, I've gotten good at taking advantage of library resources. WorldCat allows you to search for books cataloged at all libraries near you. In the San Francisco Bay Area, you can find Grokking Algorithms at the San Francisco Public Library, UC Berkeley Libraries, and Stanford University Library, just to name a few, so get it free if convenient.
Full disclosure, my links to the book are affiliate linked from the Books on Code article, so you can choose to buy the book through the article to help support Books on Code
Value Score: "A Gourmet Feast"
I say 'gourmet' because I needed a way to say that the book is packed with goodness on every page, but elegantly. It's not long and light, like in my review of the nearly-800 page The Complete Software Developer's Career Guide. Algorithms is at around 250 pages. Each page has plenty of white space and illustrations, but the complex topics are explained simply, making each page have extremely high value.
Fun Score: "An Absolute Joy"
I think books that max out the Fun Score should have a prize: like a badge or something. At Books on Code, we find resources that go above and beyond, that spark curiosity, creativity, and joy. We do not read programming books just for the utility of it, but to fuel our imagination in solving problems and help us realize our potential as programmers.
Grokking Algorithms is an absolute joy to read --- no understatement. To further attest to this, my time for reading Algorithms was in bed before going to sleep, and reading algorithms kept me engaged past my bedtime. This is a feat most programming books cannot claim.
Conclusion: "Learn with joy and cute animal illustrations"
When I read Grokking Algorithms, I had no idea how much I was actually learning.
I had spotted it at a book store, took it home, and read a little bit before bed for several weeks. I was so entertained that I returned to it night after night.
But the impact was profound.
The truth is this: I was scared to take my data structures & algorithms class. I was still ashamed for dropping it the first time.
Years prior, when taking the computer science class at my local community college, writing linked lists in C++ had completely stumped me.
I was at a coffee shop holding my head, pondering how all my variables had the values they had (which, back then, I didn't know how to use breakpoints 😩), when a non-engineering friend stumbled across me in a coffee shop and remarked in an encouraging tone, "Maybe programming just isn't for you."
I was working full-time as a blogger for an enterprise software marketing company at the time, driving from the San Francisco South Bay to the North Bay to see my boyfriend each weekend. Soon I missed my homework deadlines and dropped the class, and though I hated to think it, I felt like I had proven my friend right: programming wasn't for me.
So when I took my algorithms class for a second time, I expected to be eaten alive.
Instead, I found that I already understood all of the concepts presented to me: Big O notation, sorting algorithms, linked lists? Easy, easy, easy. Because it was all illustrated for me so memorably, I didn't experience a single hiccup in my class.
And that is truly why cute, cartoon animals got me an 'A' in my Data Structures & Algorithms class.
If you liked this article, don't forget to share it with the programmers in your life.
If you like me, Miranda, and want to hear more of my stories 😁, sign up for my newsletter at Books on Code. I write to you each week about Books on Code like you're my best friend --- because maybe you are!
And if you want to experience more joy when reading technical books, you can sign up for the free Books on Code email course, Get the Most for Technical Books. 📚
And lastly, thank you so much for being here with a thirst to learn and become the best software developers you can be. By being here, you're helping me become a better developer, too, so thank you from the bottom of my heart.
I will see you next time, whether that be on Twitter, or in an email, or in the next article. 👋
Top comments (2)
Great review! Truly a masterful book. I just want to add that this author also wrote Functors, Applicatives, and Monads In Pictures, which was pretty much the only resource that pulled together those pretty abstract concepts for me. Quite a talented educator.
Ahhhh! I love this. 😍Thank you for sharing. Talented educator is right.