>that's the real art of programming, isn't it?
Not really. The real art of programming is solving the problem without creating an unruly mess. You can learn the names and memorize the code for a thousand algorithms and still be completely incompetent.
>I guess it comes with experience, but most of my success with C++ has
>come from trial and error.
Experience comes from making mistakes.
>I would like to know if there are any recommended resources of general
>algorithms that "any self-respecting programmer should know off the top
>of his head"
When I conduct interviews, I expect the following as absolute basics in general programming:
A thorough understanding of pointers.
A thorough understanding of recursion.
The ability to at least describe the concept behind four sorting algorithms that use different solutions (eg. divide and conquer with quicksort).
An understanding of arrays and how to use them non-linearly.
An understanding of linked lists in at least three variations.
A strong foundation in binary search tree theory.
The ability to describe at least one balanced tree algorithm.
Knowledge of at least one linear probing hash table.
Knowledge of separate chained hash tables.
The ability to tell me what data structure is best suited for a situation I provide.
The ability to tell me what sorting algorithm is best suited for a situation I provide.
The ability to describe the relative strengths and weaknesses of whatever data structures and algorithms we discuss.
Practical experience with complexity theory.
A strong problem solving ability (given a tricky problem).
The ability to adapt to changes when solving problems (given a tricky problem with increasingly frustrating restrictions).
The presence of mind to know when to give up (given an unsolvable problem).
Most programmers won't know this stuff off the top of their heads (my interview is tough, but so are the jobs), but for a college course, you'll probably be expected to have minimal depth knowledge (meaning you don't need to be an expert) with very wide breadth (meaning you need to at least have heard of a lot of things). A good resource for the stuff we use is
DADS, but keep in mind that a lot of those items are very specialized.
>little tricks, little famous bits of code that work in certain situations.. priceless time-savers.. things like that..
Sorry, but that's the kind of thing you can only build up yourself.