Introduction to Algorithms, 3rd Edition (MIT Press)

Author: Thomas H. Cormen
4.3
All Stack Overflow 54
This Year Hacker News 3
This Month Hacker News 1

About This Book

Some books on algorithms are rigorous but incomplete; others cover masses of material but lack rigor. Introduction to Algorithms uniquely combines rigor and comprehensiveness. The book covers a broad range of algorithms in depth, yet makes their design and analysis accessible to all levels of readers. Each chapter is relatively self-contained and can be used as a unit of study. The algorithms are described in English and in a pseudocode designed to be readable by anyone who has done a little programming. The explanations have been kept elementary without sacrificing depth of coverage or mathematical rigor.

The first edition became a widely used text in universities worldwide as well as the standard reference for professionals.

The second edition featured new chapters on the role of algorithms, probabilistic analysis and randomized algorithms, and linear programming.

The third edition has been revised and updated throughout. It includes two completely new chapters, on van Emde Boas trees and multithreaded algorithms, substantial additions to the chapter on recurrence (now called "Divide-and-Conquer"), and an appendix on matrices. It features improved treatment of dynamic programming and greedy algorithms and a new notion of edge-based flow in the material on flow networks. Many new exercises and problems have been added for this edition. As of the third edition, this textbook is published exclusively by the MIT Press.

Comments

by Phenom10x   2017-12-06

So more about data structures and algorithms ey? Well the main book pretty much every college uses is this one:

Introduction to Algorithms Third Edition by Cormen, Leiseron, Rivest, Stein

This book is basically an encyclopedia of algorithms and data structures.

Desktop applications are just programs. You can make python into an executable using: http://www.py2exe.org/index.cgi/Tutorial

If you mean how operating systems work there are books out there that explain that. But I don't think that's what you mean't haha.

Hope this helps.

by ToadstoolBeTrippin   2017-12-06

The one book that every programmer should read is Code Complete . It goes over all stages of development in a high level overview that applies to any project.

I would then move onto Algorithms by Sedgewick and Wayne. I tried reading Introduction to Algorithms because it was strongly suggested to me, but it goes into higher level math really quick. I haven't taken calculus since high school and never took any higher level math classes in college, so I got lost after about page 30.

After that, I would just look for a book dedicated to design patterns in the main language you work with. There are some overlapping patterns between languages, but it's best to be practical about what you learn.

by _INTER_   2017-12-06

If you want to get a head start at the college, I'd rather get more fundamental programming knowledge. Get a book about algorithms and datastructures (e.g. this or this , first few Google results pointed me to a PDF).

Well of course practical knowledge is also never bad.

by anonymous   2017-11-27
Hi , welcome to SO , it's not the purpose of this site but to answer your question this is a good book : https://www.amazon.com/Introduction-Algorithms-Thomas-H-Cormen/dp/0262033844
by panta   2017-10-11
I can't recommend courses, because I don't have direct experience of any, but given what you say, my suggestion would be to take a bit of a pause from pragmatic problems, and dedicate some time to learn the foundations of computer science, in particular about algorithms and data structures. I'd recommend a couple of books: "The Algorithm Design Manual" by Steven Skiena if you want something not too theoretical, or "Introduction to Algorithms" by Cormen, Leiserson, Rivest, if you want a bit more breadth and theory:

https://www.amazon.com/Algorithm-Design-Manual-Steven-Skiena...

https://www.amazon.com/Introduction-Algorithms-3rd-MIT-Press...

As a second suggestion, I'd recommend to learn a language somewhat different from JavaScript-like (or C-like) languages, something that challenges your mind to think a little differently and understand and create higher order abstractions. There are many choices, but to avoid confusion and being my favourite, I'll point to one: read the "Structure and Interpretation of Computer Programs" by Abelson and Sussman. It teaches Scheme in a gentle and inspiring way but at the same time it teaches how to become a better programmer:

https://www.amazon.com/Structure-Interpretation-Computer-Pro...

I can't recommend it enough. If you read it, do the exercises, don't limit to read through them.

Maybe it's even better if you start with this, and THEN read the books on algorithms and data structures.

Enjoy your journey!

by imakecomments   2017-08-20
As a follow up to this resource I recommend,

Algorithms unlocked: https://www.amazon.com/Algorithms-Unlocked-Press-Thomas-Corm...

CLRS: https://www.amazon.com/Introduction-Algorithms-3rd-MIT-Press...

Both include the same author as the one in this article (Thomas Cormen).

by imakecomments   2017-08-20
This is just my opinion and I'm sure it differs from others...

Roughgarden's class is advance and expects mathematical maturity. You may find his course quite fast and rough if you are a beginner.

Sedgwick's class is much easier. He is a bit boring and tries to use "real life" examples (in some instances) from the physical sciences to make the material relatable. This in my opinion detracts from the material. Also, he doesn't always fully explain where he got some of the big ohs here and there.

My advice? Follow MIT's OCW course (it uses CLRS). Supplement it with Algorithms Unlocked, the Khan Academy link in OP and CLRS. If you use those 4 resources and put in the work you'll understand the material.

All 4 sources have Thomas C's DNA touch to it (he is the C in CLRS). So you'll find it consistent when you read from one source to the other. After reading/hearing the same thing about 4 different times in 4 different ways it'll begin to click.

Order of easiness is probably Khan Academy > Algorithms Unlocked > MIT Algorithms Course > CLRS.

Algorithms Unlocked is like "pre-CLRS" and Khan Academy's version is the TL;DR version of Algorithms Unlocked.

Hope this helps.

Below are the links,

https://www.amazon.com/Algorithms-Unlocked-Press-Thomas-Corm...

https://www.amazon.com/Introduction-Algorithms-3rd-MIT-Press...

https://www.khanacademy.org/computing/computer-science/algor...

https://ocw.mit.edu/courses/electrical-engineering-and-compu...

by anonymous   2017-08-20

Dynamic problems also requires "optimal substructure".

According to Wikipedia:

Dynamic programming is a method of solving complex problems by breaking them down into simpler steps. It is applicable to problems that exhibit the properties of overlapping subproblems which are only slightly smaller and optimal substructure.

Backtracking is a general algorithm for finding all (or some) solutions to some computational problem, that incrementally builds candidates to the solutions, and abandons each partial candidate c ("backtracks") as soon as it determines that c cannot possibly be completed to a valid solution.

For a detailed discussion of "optimal substructure", please read the CLRS book.

Common problems for backtracking I can think of are:

  1. Eight queen puzzle
  2. Map coloring
  3. Sodoku ?

DP problems:

  1. This website at MIT has a good collection of DP problems with nice animated explanations.
  2. A chapter from a book from a professor at Berkeley.
by anonymous   2017-08-20

You can check the explanation of a variation of this problem in CLRS (section 15.1, page 360). The problem is called the Rod Cutting problem.

Your approach is correct, and you can formalize it as a recurrence relation.

f(n) = min(f(n - i) + price(i)).    1 <= i <= n - 1

where f(n) is the minimum price to buy a rod of length n. using memoization, this can be calculated in O(n^2).

by anonymous   2017-08-20

This can be formulated as a Linear Programming problem. You want to maximize or minimize a function (representing the "weight" or "goodness" of the solution) subject to certain constraints (your requirements). You'll need to formalize your requirements as values. Something like this:

Variables:
x1 = 1 if Labels overlap, 0 otherwise
x2 = some measure of "how much" a label overlaps a bubble
x3 = distance from label to bubble //Label should be close to bubble
x4 = distance between ideal and actual label position
x5 = difference between actual and ideal font size


minimize x1 + 10*x2 + x3 + 20*x4 + 5*x5

subject to constraints:
    x1   = 0  // labels can never overlap
    x2   < /* maximum amount a label is allowed to overlap a bubble */
    ...
    x5   < 6 // font size does not vary by more than +/- 6 pts.

I made up the coefficients and the constraints, you can use them to tune the result based on which features are most important to you. Coefficients increase the value of a requirement (in this case, f4 is weighted most so it 'most important'. The constraints are hard limits that cannot be violated.

Since this is a well-known problem, you can now solve it using a number of methods. The Simplex algorithm is popular. There is a whole chapter in Cormen et. al about these problems.