

I have problems keeping a mental model of algorithms, loops and calculations - umfufu

Hello HN, longtime lurker.<p>I have been programming for about 2 years, but not any really advanced stuff, and I have never really gotten into algorithms, its been mostly "webview" related, display stuff from a database with java, php, etc.<p>Lately however I have been getting more into algorithms, and I notice that it's really quite hard to me to keep a "mental" or "visual" model of what I am doing or what I am looking at for things like quicksort, &#60;insert other algorithm here&#62;, etc.<p>I wish to get better at this stuff, math is not really my problem, my problem seems to be that it's just difficult for me to keep track of the whole thing in my mind while I am doing it, is this normal or do people just write their loops with multidimensional arrays with objects and condition checking and calculations with their eyes closed?<p>A lot of the material on algorithms I find hard to grasp as well, is there any introduction to algorithms, complex loops and datastructures for people that have trouble with this? I don't wish to give up, it's so damn exciting and im curious about this but I don't know how to keep on like this, it's hard for me, help me ;-) - perhaps there is some easier material to start with where they really visually explain this stuff or how to think about this stuff?<p>Thanks in advance everyone.
======
thequux
Quicksort is a wonderful example of an algorithm that's really simple, but
that gets mired up in implementation details to the point of being
unrecognizable. The fundamental insight of quick sort is that you partition
the list into items smalller than a given value and items larger than that
value. Then you just sort the subitems.

Most algorithms are similar; there's a core idea and then a bunch of
implementation around it. My advice for dealing with that is to build up a
library of routines that you know the complexities of, and then use those to
build more complex algorithms.

Unfortunately, I'm not in a good environment to write code right now, but I'll
give an example of how that might work when I get home.

In terms of reference material, check out CLRS

------
thetabyte
Sort visualizers: <http://www.sorting-algorithms.com/>
<http://cg.scs.carleton.ca/~morin/misc/sortalg/>
<http://math.hws.edu/TMCM/java/xSortLab/>

