Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: How to Get Good at Algorithm Design?
21 points by sidcool 40 days ago | hide | past | web | favorite | 6 comments
I have been trying my luck with CLRS, some Skienna, Leetcode and HackerRank. I have gotten a bit better at it, but nowhere near where I could come up with a brand new algorithm. Any pointers what I may be missing? Is it Math? More practice? I really want to get good at it. My real interest is in Scientific Computing, but that's for another day.

If you want practice, Algorithm Design, by Jon Kleinberg and √Čva Tardos has 200+ problems to design for, with walk through solutions to many of them. The problems are all class-tested in homework or exams by students at Cornell. Algorithms: Parallel and Sequential book by Umut A. Acar and Guy E. Blelloch walks through many of the same undergrad algorithmic techniques finding opportunities to split up the work, chap3 walks through genome sequencing methods for example http://www.parallel-algorithms-book.com/

The Design and Analysis of Algorithms, by Dexter Kozen is 40 self contained lectures, introduces theory I didn't read in the other books, and his analysis walk throughs are well written. It's much more definition->lemma->theorem style but if you know set theory and familiar with graphs, trees, DAGs from the CLRS book you can understand most of the lectures.

Designing novel algorithms is very hard. You can borrow some ideas from the existing literature, but you have to figure out how to apply them to your problem and that can take some nontrivial inspiration.

I have one paper with a few new algorithms in it and that took me several years to write in grad school. The algorithms themselves aren't that complicated, but the concepts and theorems we had to come up with to support them required some genuine insight.

A brand new algorithm as in an algorithm to solve a common problem that has never been invented or an algorithm that solves it faster than known algorithms?

Try projecteuler.net.

There are some pretty great problems in there and your solutions might be novel.

Be forewarned that once you get up into about the triple digits, it starts becoming less about algorithmics and more about how much math (particularly number theory) you know or can pick up while working on the problem. Easy to get rabbit holed.

By studying and applying existing algorithms a lot, you start noticing patterns. CLRS goes into general concepts such as divide&conquer, dynamic programming etc.

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