Welcome

This website contains my takes on the solutions for exercises and problems for the third edition of Introduction to Algorithms authored by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein, commonly known as CLRS.

Note: If you are looking for complete solution for the book. This is not the place to be. As of March 2021, I have barely compiled solutions for first four chapters and one appendix.

I have included a list of other online resources which you can refer if you are looking for solutions to some chapters that I don’t have.

Some Backstory

Back in 2008-09, during my university years, I did not have much of a background in programming and Computer Science was a completely new concept. CLRS was the main textbook for two different courses that I had to suffer through. Red-Black trees in particular gave me nightmares.

Lot of things changed By 2015. I’ve been working as a software developer for 3 years by then. Hands-on experience in coding and debugging helped me in understanding the beautiful intricacies of data structures and algorithms. And I started revisiting CLRS to understand DSA from a practical point of view.

Motivation

Around the same time, I thought of compiling solutions to exercises and problems in a website to help others. And the main motivation was to explain the solutions in a way that I wish someone did for me when I was in college.

That means:

  • Building intuition is more important than working out the mathematics
  • Not trying to “finishing the syllabus” by just providing the answer
  • Not assuming every reader is a genius CS prodigy
  • Providing practical example or working code whenever possible
  • Explaining the logical thought process on how to reach the solution

2020 Edit

As of 2020, I also plan to use this website for some selfish reasons:

  • Experiment with latest web development/deployment related technologies.
  • For example, in 2015 I developed this website with Bootstrap/jQuery and GitHub pages. Now it has been moved to pure Jekyll based static website without using any heavy framework. It is deployed using GitHub actions.
  • Learn more about project management and deployment workflows using GitHub.
  • Learn more about web analytics using Google Analytics.
  • And finally use Adsense to generate some revenue from whatever traffic I receive.

Completeness of the solutions

As mentioned earlier, this website do not have complete solution for the book. Due to my day job and many other commitments, I had stopped working on this after 2016. Recently during COVID lock-down, I have revived my interest in maintaining this work.

However, there is no plan to provide complete solution. I will stick to my motivation for doing this, and add solutions whenever I can.

There are many other online resources that has near complete solutions. Some of these are:

You can probably follow any of these if you are looking for the solutions.

In fact I myself follow most of these when I’m stuck on some problem or want to verify the correctness of my solution.

How to contribute

You are welcome to leave comments on the particular solutions pages if you found any error or have a suggestion for better solution.

Also if you want to clone and create PR for new solutions, I’d be happy to merge the changes provided the explanations are inline with my motivation.