C Algorithms

• 09-27-2001
Garfield
C Algorithms
I had heard of a C programmer that invested in a book on C algorithms. Do you think this is a wise investment? Will this help programming in C and make it better? What kind of algorithms would those be? Thanks...

--Garfield
• 09-28-2001
The V.
Well, it depends on what you want to do.

I'd recommend everyone learn about data structures, as they are applicable to all types of computing.

You can buy books of many different varieties of algorithms. It all depends on what your goal is.

At the moment, I have a book on Neural Network programming I'm working from, as part of a 500-level college course. The book contains many algorithms for how a neuron learns -- as the programmer, I decide what kind of model to apply, and what pieces of data to apply it upon, and I look up the algorithms that the model I choose uses.

An algorithm is nothing more that a series of steps, which are clearly defined enough for a computer to follow, that will allow you to realize a desired output. People do long studies to try to figure out good algorithms -- as the programmer, why reinvent the wheel? Take the tools that other people have given you (for example, algorithms to fit an N-order polynomial to a given dataset, algorithms to invert an NxN matrix, etc) and apply them intelligently.

If every programmer had to rediscover the algorithms they use, we'd never get anything done.

A lot of the literature you should own depends on your skill level, and the types of programming you do. Certain kinds of programming, especially in math-intensive areas, is hugely dependant on algorithms, and which algorithm you choose for a problem may have HUGE impacts on speed of execution, precision of output, and memory required. For these areas, you SHOULD buy literature, you should do research, etc. But the average user will never need to know, for example, that the optimal weights for ECL batch learning by least squares is equal to the product of the inverse of the time-averaged variance-covariance matrix and the time-averaged cross-correlation vector. You, probably, will never use that algorithm. I have, and will most certainly need it again before the semester is over.

As a general rule, a few kinds of books or courses are good for ANYONE:
1) Object-Oriented Programming -- if you use C++, this is a must to learn.
2) Data Structures -- arrays, linked lists, binary trees, perhaps octrees. Good stuff to make all programmers manage data.
3) Basic Algorithmic Optimization -- it's not necessary to memorize specific algorithms, necessarily, but it's good to know what people mean when they say something is O(N^2) instead of O(N), for example, and more importantly, to know what this means in regards to a problem you have. Often this will be taught WITH data structures, as they are, to a degree, interrelated.

Bottom line: Everyone needs to know SOME algorithms of some kind, because they are the heart and soul of computation. But which ones you learn is highly dependant on which ones you need.
• 09-28-2001
mithrandir
Yes go for it - try searching for Knuth's "The Art of Computer Programming" Volumes 1-3(from amazon). Yeah it's probably little a bit heavy for you to take in, but I would serioulsy suggest that you do try to read up on Algorithms as much as possible (after you've got a firm grip on c/c++). Data Structures too are a major area of programming.