Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: How can a dummy like me learn algorithms?
30 points by alansmitheebk on April 29, 2016 | hide | past | favorite | 15 comments
I don't have a CS degree. I sucked at math in high school. I never took calculus. I need to learn the classic algorithms to frow as a programmer. I have found some resources on coursera and some books, but most require knowledge of proofs and other maths stuff I never learned. Can anyone point me to some resources for learning enough basic maths to then learn algorithms?

I realize that I probably sound like a complete idiot here. I genuinely want to better myself and I'm humbly asking for help.

TIA Alan

As someone who was pretty "good" at math and CS algorithms, I'll let you in on a little secret: None of this is comes naturally to me. I struggle when encountering new ideas that I've never seen before. I've bombed easy technical interview questions because I couldn't make the right logical leap.

I still got good grades back in the day because I worked hard. I ground problems until things made sense. Every problem you do adds to your problem solving toolbelt. As your toolbelt grows, you start noticing patterns and you can apply those tools to these new problems. I rarely have to derive things from first principles because I've seen so many different problems at this point.

Some people think that I'm unusually smart or have a natural aptitude for these things. That can't be further from the truth - I don't think this comes naturally to most people. You just work at it until you get good at it.

The best textbook I've found for Algorithms is the one used at Princeton: Sedgewick's "Algorithms." It's extremely practical and doesn't go into too much of the math/proofs behind the algorithms themselves. From there, just grind problems until it makes sense.

Since you don't have a CS degree, and since your goal might be characterized as practical growth, here's a shortcut guide:

* Learn the Big-O notation characteristics of data structures and algorithms you're going to use in the real world. Understanding data structure selection is probably more important than understanding the algorithms

* If you want to learn algorithms, the best (empirical) place to start is with solving real problems, efficiently. So some of the contests/HackerRank type things here would be very good. Try them on your own--don't worry about efficiency, just worry about a working answer. Then go study the right answer for the problems. Understand the solutions thoroughly.

* Don't be afraid to prematurely optimize some problem you have to solve. Trying to eke out more performance is a great way of understanding the representation of data and its transformation. You'll be well on your way.

I've been in the industry for decades. The number of sorting algorithms I've written in college versus ones I've written in industry is still at least 5:1. But I've had to optimize far more stuff in industry than I did in college, and develop algorithms for solving real problems that wouldn't make sense to teach in school. So expose yourself to solving real problems! It'll pay off.

Khanacademy has some good resources, seemingly, including teaching Big-O notation. Also, if you are familiar with a programming language in particular, Rosetta Code can give you an example of the algorithm in that language.

But in my experience (which should be taken with a grain of salt, as a person who never took cs and never took calculus), understanding algorithms doesn't take a lot of math, just a bit of persistance in understanding how they work, and a dash of common sense. The hardest math is that behind calculating big-O for time and space, which can again be approximated for most simple algorithms with a bit of common sense. This (http://stackoverflow.com/questions/487258/plain-english-expl...) stackoverflow is probably the best explanation I've seen.




-Binary Search

-Searching a single-linked list

-Hashtable insertion/deletion

-Djkstra's Algorithm

-Heap Sort

-Huffman Encoding

You don't have to know all of these, and the difficulty of understanding varies, but these are important, and a good place to start.

Try something like HackerRank. It's pretty fun, bite-sized problems that range in difficulty. I found implementing algorithms result in a deeper understanding that just studying pseudo-code. When you go back and read more about the algorithm you implemented, it'll make much more sense.

I think greatest dis-advantage you will face when you would try to learn this outside of university is that you probably won't have class-mates to help you and professor to give you an exam at the end. One of the reasons why I finished uni was peer-pressure, i.e: when my friend managed to pass that exam already, darn, I shall sit on these algorithms until I am able to explain them in my sleep :) Fortunately, many MOOC are trying to replicate the claasroom experience now, if you had similar experience.

I really enjoyed Robert Sedgewick's Algorithms (part I and II) courses on Coursera. I learned much more in those classes than I did in my data structures class in college. The textbook that accompanies it (Algorithms Fourth edition) is really good too. I left that course with a much, much stronger understanding and appreciation for algorithms/data structures.

HackerRank is great. I agree with @bko. I would also like to point out a few books that I read in college that helped me out too. Cracking the Coding Interview is a great book that explains the most common algorithms job interviews will ask. Reading is my favorite way of learning.


Hey, you may not need much maths for this.You just need to be familiar with python and ready to work.It is pretty straightforward http://interactivepython.org/runestone/static/pythonds/index...

Check out coursera. UC San Diego just started an entire program full of algo classes.

Here's a link to that series: https://www.coursera.org/specializations/data-structures-alg...

What's impressive about it (to me) is that, unlike other Coursera series & courses I've looked at, there is a set schedule for when each course in the series will be offered, allowing you to better plan how the courses might fit into your schedule.

I'm on the same boat as you, don't feel bad about it, I feel the same way when I ask for help on StackOverflow. We have to start somewhere right?

The only thing that comes to my mind might be "Discrete Mathematics" by Ross, Wright. This is quite a heavy book and you don't need to go through all of it, but there are some chapters that might be really useful (the one about mathematical induction is probably the most important).

Also, I think I can help you a bit. Send me an e-mail at throwawayt52@gmail.com

Look at the free course [A Visual Introduction to Algorithms] (https://www.educative.io/collection/10370001/760001).

Full Disclosure: I'm a co-founder of Educative. The above course was derived from Khan Academy's amazing Algorithms course.

Still in beta, but Google Code Jam has a new Tutorials section:


Start with basic File I/O. Then begin working on the beginner level problems. Read the contest analyses when you get stuck. Best of luck! :-)

Step one: stop calling yourself a dummy. Step two: learn them.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact