WARNING: This is an ever-evolving work in progress. Frequent revisions/extensions are to be expected to both the content as well as the content’s organization.
PRO TIP: Want to skip the introduction? Find the exact algorithm or data structure you desire in the index.
Welcome to Algorithms and Data Structures presented by the Hideous Humpback
Freak. As listed in my bio, my personal goal is to increase the
technical acumen of as many software professionals as possible. That’s what
this site is all about! I aim to cultivate a resource that places a
graduate-level comprehension of algorithms and data structures within anyone’s
graph. The only requirement is a passion for learning. The content caters to a
broad audience, regardless of educational background, with an emphasis on
intelligibility. It is a convenient review resource for experienced developers
as well as a concise educational appliance for aspiring software experts.
Every algorithm, or data structure as the case may be, receives proper
treatment including supporting concepts, detailed descriptions, cartoons,
accessible pseudo-code, asymptotic analysis, actual run time comparisons, and
common use cases. The pièce de résistance is fully functional
C code (fluency
C language is not a requirement) complete with unit tests showcasing
Why Algorithms and Data Structures?
There are domains (e.g. embedded, operating systems, programming languages, kernel, etc…) where a deep understanding of data structures and algorithms is absolutely requisite. It’s simply not possible to write software in these contexts without it. The majority of developers work in other domains (business applications, web development, mobile apps, data science, etc…). For them, it’s possible to make the argument that such skill is superfluous. However, that is a myopic perspective.
There is no denying that high-level languages abstract away many algorithms and
data structures from developers. For instance, utilizing an
Iterable in Java, or
list in Python does not require the developer to
understand the difference between a linked list, binary tree, or array. This is
a fair point, however; employing abstractions devoid of comprehension is nothing
more than cobbling objects together until something eventually works which is
adequate for only the most parochial of use cases. The standard set of language
high-level abstractions are seldom sufficient for advanced scenarios.
For demonstration’s sake, suppose a programmer is never going to implement or even employ an abstraction of a particular algorithm. Is it still worth their time to study it? The answer is an emphatic YES! Studying algorithms is more than just memorizing patterns. It instills problem solving techniques into the adherent. Writing elegant code requires intimate knowledge of what elegance looks like. The classic algorithms are a catalog of code with unparalleled elegance. As Tim Roughgarden is fond of saying, they are the “greatest hits” of software. One of Frederick Nietzsche’s most famous quotes is, “if thou gaze long into an abyss, the abyss will also gaze into thee”. The meaning being that you will become what your mind focuses on. Simply gaining an understanding of famous algorithms and data structure will change the way you code.
Another common argument against studying algorithms is that the time could be better spent on more “modern” topics. Many software professionals spend inordinate amounts of time learning frameworks (e.g. React, Spring Boot, Boost). While this is laudable, the fruits of such labor are ephemeral because frameworks come and go and the earned competence is seldom transferable. Conversely, algorithms and data structures are at the very heart of software. They are enduring concepts that have been in use since the forties. Such knowledge makes every related subject, including frameworks, more accessible. Any individual adept in enduring concepts will outperform an individual adept in fads. Stated concisely, the return on investment from learning algorithms and data structures is considerably higher than any other software topic.
To sum up the why, any developer ignorant of what lies beneath is constrained by the simplified view that high-level abstractions expose and is therefore a slave to them. Advanced solutions require deep comprehension of core algorithmic concepts. The study of algorithms and data structures is the most efficient route to mastery of any software topic.
Why Use the C Programming Language?
The choice of the
C language for demonstrating algorithms is uncontroversial.
Its popularity1 implies that most software professionals have at
least some exposure. Having only 32 keywords, it is easy to learn. The most
compelling reason is that it provides little to no built-in data structures or
algorithms. Simply invoking the high-level abstractions provided by other
languages deprives programmers of the experience required to build acumen. The
C language provides the opportunity to build from scratch which stimulates
deep comprehension. It’s a language that every developer should learn and become
proficient in regardless of whether they use it professionally or not.
As a final note, it’s important to understand that the choice of
C for this
content is not an endorsement for or against the language in other contexts.
C’s low-level nature make it prohibitive for most standard business use cases.
It’s typically advantageous for performance critical, real time, and embedded
applications. However, even in those instances there are complications arising
from security exploits and indeterministic undefined behaviors. Keep in mind
that there is no best language for all applications. Thoroughly evaluate
your context and choose the best fit.
What Makes this Content Unique?
There are already so many great resources for algorithms and data structures, why does the world need yet another one? This is a fair question that deserves a fair response. The truth is that most of the information covered here is derived from these popular books:
- Introduction to Algorithms, Third Edition by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein
- Algorithms Illuminated (Part 1): The Basics by Tim Roughgarden
- Algorithms Illuminated (Part 2): Graph Algorithms and Data Structures by Tim Roughgarden
- Algorithms Illuminated (Part 3): Greedy Algorithms and Dynamic Programming by Tim Roughgarden
- Algorithm Design by Jon Kleinberg and Éva Tardos
- Algorithms by Sanjoy Dasgupta, Christos Papadimitriou, and Umesh Vazirani
- The Art of Computer Programming by Donald Knuth
These books are amazing, and the authors are no doubt geniuses. However, they aren’t the most accessible of resources as they assume the reader has a consummate background in mathematics and computer science. Even those with such a background must expend a good deal of mental energy to absorb the material. On the other end of the spectrum, sources for beginners rarely provide a thorough enough treatment to be useful in practice.
Much like Buddha’s Middle Way, this site aims to balance the two extremes. It provides content that is practically applicable without academic pomp. The Hideous Humpback Freak is an accomplished software professional that has applied algorithms in real world contexts which adds a level of profundity to the material. What’s more, nothing is presented here without working software accompaniment. Stated concisely, this is legitimate content for developers whose aim is to efficiently attain the skills required for practical application.
As a final added bonus, the Hideous Humpback Freak is happy to personally provide support. Please ask questions, leave comments, or make suggestions in the comments section located at the bottom of each page. Although I’ll ask you to respect my time, I’m willing to speak via Google Hangouts if necessary. It’s a win-win situation because you will get the help that you need, and it will improve the content.
Without further ado, it’s time to start learning. Good luck to you!
The IEEE ranked
Cas the 3rd most popular language of 2019. https://spectrum.ieee.org/static/interactive-the-top-programming-languages-2019 ↩