Hi HN'ers,<p>I am from a non-CS background. I find myself able to make stuff work and resolve issues in case any pop up, but i do not find myself writing the most optimized code.<p>How do i learn algorithms ? The problem is that the suggestions posted in various posts in HN are pretty intimidating to start. Is there a beginner friendly book or a youtube lecture that de-mystifies and simplifies learning algorithms ?<p>I mailed a few people whom i admire if they could provide guidance and / or mentor me, but haven't found help. IRC channels are intimidating too.<p>I would be grateful to the community for any help.
Coursera has a couple of courses on algorithms that would be acceptable for beginners but also very challenging (in a good way).<p>MIT OCW's Intro to Computer Science and Programming (in Python) covers a lot of ground related to programming (more than just Algos), but it covers some essential sorting algorithms and eventually gets into dynamic programming. I don't think anything much simpler than this would be worth your time (not to say this is the best), but the readings themselves (especially those from wikipedia) can actually be a little dense:
<a href="http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00sc-introduction-to-computer-science-and-programming-spring-2011/" rel="nofollow">http://ocw.mit.edu/courses/electrical-engineering-and-comput...</a><p>MIT OCW also has a full course on algorithms.
I come from a non-CS background too, and currently my interest in software development is mostly as a hobby and to build a base I might use in a job later on.<p>Remember that "making stuff work", aka prototyping, is incredibly important, and in fact an extremely desirable skill: in so many situations, it can be impossible to see the forest for the trees when building a new idea or architecture, and the design is still on paper; things frequently need to be built out into working first drafts for edge cases or gotchas to become apparent. Often, the result is that everyone might need to go back to the drawing board and start from scratch, so rapid turnaround is essential.<p>Going beyond the basics in any domain is a categorical form of specialization, and specialization in any context tends to require a lot of investment, and the return it gives predominantly leans toward inflexibility and a narrow field of application.<p>When tackling arbitrary, ambiguous problems, the statistical likelihood your specialized knowledge will come in handy is, on average, going to be quite low, unless you're in an academic environment that focuses on your specialty.<p>So don't shun the skillset you already have in "making things work." :D<p>By all means dive into algorithms - just remember the info will likely stay in if you do so at a slow, non-anxious pace and keep your experiences positive ^^
there are so many algorithms
in so many different areas.<p>it may work to start with just one area,
an area that is close to something you already are making or solving, and then, literally, in searching for algorithms for that pick the shortest one and solve a small implementation of it.<p>in finding a reference implementation i found the following helpful :<p>-- pick code in the same language you will be writing your version in.<p>-- if you can, find and read the original paper ( try searching google scholar ) describing the algorithm, these are often clearly written and explain the motivating situations that led to the way the algorithm was constructed.<p>finally some example short algorithms from a few areas and favorites of mine :<p>string processing :<p>-- LZW algorithm<p>-- longest common subsequence algorithm<p>tree graph processing :<p>-- post order depth first search<p>list processing :<p>-- group elements in an array into sub arrays of length k<p>integer processing :<p>-- change of radix algorithm ( change a mumber from the given base ( 10 ) to base 2 ( or even to other bases as well ) )<p>most of all, just work your way through step
by step, like the algorithms your are making.
I suggest that you work patiently through a good text on algorithms and data structures that has code samples in it. I recommend "Algorithms I and II" by Sedgewick or "Data Structures and Algorithm Analysis in Java" (or the C++ version) by Weiss. I also hear good things about "Data Structures and Algorithms in Java" by Lafore.<p>The above books are quite apt for beginners. You should expect to struggle a little but you must persevere anyway. I remember struggling with sorting and matrix multiplication algorithms when I learned it the first time in school. Do not mistake your unfamiliarity with the subject for its inherent difficulty! Once you write a few sample programs and see how the algorithms play out, you'll get the hang of it.
If you do not have a math background , I suggest you start with Logarithmic analysis and properties of logarithms ( many tutorials in youtube ), then attend the Coursera algorithm courses and some selected courses on CS50's youtube channel.
Often, the first examples of computer algorithms involve sorting. There will be some discussion of "bad" sorting algorithms that run in O(n^2) time. This will illustrate how to use algorithmic analysis to understand time complexity. Then the faster merge-sort will be introduced as an obvious improvement to O(n log n) time, followed by quicksort with O(n log n) time <i>and</i> O(n) space...and at this point you may reasonably ask, "So what?"<p>The thing is is that merge-sort was discovered by John von Neumann [1] and QuickSort by CAR Hoare [2]. The less accomplished of the two won a Turing Award and one might quite legitimately walk away with the belief that developing algorithms from scratch may be non-trivial simply because the subject is really hard.<p>Which is a round about way of coming to some advice: if the very subject of algorithms isn't enough to scare you off, don't fret the fact that the presentation looks difficult. The apparent difficulty is in the subject itself and the only thing a gentle introduction or simplification means is that someone is pretending that the subject of algorithms is not really really hard with the natural consequence that when it does get hard, you're more likely to see the struggle as a failing of the student rather as inherent in the subject matter. And everything interesting and important in algorithms is <i>hard</i>.<p>This is why I don't hesitate to suggest people consider <i>TAoCP</i>. It covers the "easy" parts as well as or better than anything else I've seen. It just requires being ok with not understanding everything or even most things that Knuth covers because he finds them important and interesting. Because I'm never going to be that smart, I might as well work at my own pace, and celebrate the small victories like grasping the answer to one of the easy exercises that a year ago, I wouldn't have grasped.<p>The other recommendation is to take an algorithms course on Coursera. It's free.<p>Good luck.<p>[1]: <a href="https://en.wikipedia.org/wiki/John_von_Neumann" rel="nofollow">https://en.wikipedia.org/wiki/John_von_Neumann</a><p>[2]: <a href="https://en.wikipedia.org/wiki/Tony_Hoare" rel="nofollow">https://en.wikipedia.org/wiki/Tony_Hoare</a>
One thing I really liked was using Project Euler. Step 1 for any given problem was to solve it. Step 2 was to go through code written by others benchmark it, and learn why there code was faster than mine.<p><a href="https://projecteuler.net" rel="nofollow">https://projecteuler.net</a>
I'm pretty much in the same boat as you. Perhaps we can collaborate and work through the study material together? If you're still reading this thread and are interested in this, please reach me via email – me at vivek dot im.
I found the Khan Academy course on algorithms to be a good introduction. It doesn't get too in depth, but does explain things well and has some interactive coding examples.