

Algorithms: what are they good for? - henryandjohn

what are they actually useful for? 
ive been programming for a few years and i've never had to actually use one...<p>i just started learning about them and they are pretty cool but i'm not really sure what to do with the knowledge.<p>if they really are useless, i'll still keep learning them just because they are cool.
======
cd34
Good god, absolutely everything. (sorry, couldn't resist)

An algorithm can tell you how to do something, but, doesn't necessarily
contain the code to do so.

When faced with a list of items, you might be inclined to just use someone
else's library to do a bubble sort or a quicksort or a merge sort, but, when
you know the algorithm behind each method, you can make a determination
whether your list is mostly ordered, or mostly unordered and make a decision
as to which one to use.

Similarly, when you're dealing with compression, it makes sense to know that
deflate and bzip are fairly similar, but, other compression schemes might be
different. lzfx uses a simple run length encoding and doesn't compress as
well, but, works very well for streaming data. Sample size would tell you that
short 120-240 byte strings won't do well with bzip due to the dictionary token
header, but, longer files where you can determine longer repetition strings
can provide better compression.

Knowing how things work helps you make the decision of which library to
implement rather than just taking the Internet's word for it. Yes, sometimes
the Internet contains bad information.

Almost everything you code, probably uses an algorithm somewhere - you just
may not be making that association.

Sure there are algorithms that you may never use, but, in general, knowing
what to look for can help you find a library that more closely handles some
problem you're trying to solve.

