When I started learning programming as a teenager in the mid-nineties, I had to learn much about search and sort algorithms, linked lists, smart pointers, binary and quadtrees, design patterns, memory management, and more.
On the one hand, you get speed in learning to code and less frustration in getting basic things to work. Most famous data structures, algorithms, and design patterns are baked into popular programming languages. On the other hand, not knowing what happens under the hood can result in choosing the wrong solutions and techniques, and writing code that is less than optimal.
This is especially true for self-learners, which account for a considerable percentage of the developer community. I had been looking around for a good introductory book on data structures and algorithms for a while.
I recently had the chance to read Data Structures the Fun Way by Jeremy Kubica and found it to be the perfect book for novice programmers as well as developers who want to improve their knowledge of key software concepts.
Learning the basics
Kubica takes you through all the major algorithms. You get to learn about popular search algorithms such as quick sort, tree sort, and bubble sort. You also get to know the mechanisms of main data structures such as linked lists, double-linked lists, stacks, heaps, and quad- and oct-trees.
Even if you’re not going to implement these algorithms and data structures manually, it is important to know them. For example, in Python, you have several ways to store arrays and indexed lists. The interfaces of these data types largely overlap, and they can be used interchangeably in some situations. But the algorithms they use under the hood are very different, which can result in different performance levels based on how you use them. The documentation for each language usually states which algorithm is working behind the scenes for each type of container.
Some of these algorithms and structures are optimized for indexed access while others are suited for sequential access. Some perform better when their size is static while others are designed to grow dynamically. Knowing these small details is very important, especially when you’re dealing with very large data sets.
Therefore, knowing the mechanisms of sorting and storage will be very helpful in choosing the best kind of storage method for your variables. (Again, I have to note that different languages add their own nuances to data storage, but the basic ideas are the same.)
One of the things I enjoyed about Data Structures the Fun Way is the way Kubica lays out the examples. Throughout the book, you’ll see a mix of hypothetical examples about coffee beans to explain complex software concepts.
Kubica uses Python-like pseudocode to display examples, which is both good and bad. On the one hand, the examples are really easy to browse, especially as they get longer. On the other, you’ll have to do the full implementation yourself. Then again, this is not too bad a thing, since it forces you to write your own code and learn better.
While Data Structures the Fun Way is not the ultimate guide to data structures and algorithms, as the name implies, it is a fun introduction to the topic. As someone who has studied and implemented data structures and algorithms on several occasions, I found the book refreshing, especially on some of the more advanced topics, such as skip lists and bloom filters.
Kubica’s book could be a good starter to get you on a journey to explore data structures and algorithms in depth.