Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

By far my favorite is Depth First Search (DFS). It's almost a bread and butter algorithm for a lot of problems (at least for quick tests) with only a couple lines long in its recursive form. Some example usage: - combinations - permutations - generating sequences - exploring tree structures - finding paths - solving pretty much any search space problem and much more. It's not the most efficient for the large majority of these cases but it allows you to throw 10-15 lines of code to quickly test an idea before actually working on it.


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

Search: