"Cryptography is a black art; if you don't know what you're doing, you can easily get into trouble."

- Bruce Schneier: Applied Cryptography, 2nd ed.

Algorithms are, as told above, "blueprints" of how specific computing tasks should be done.

There are many different sorts of algorithms for many tasks, some better suited for some tasks, some for others. Good rules to remember:

- Don't pick them from your hat. Choose well.
- Don't make shit up. Someone who had IQ way, way, way above yours invented a better one, so use that instead. (And there's
*nothing* to be ashamed of about that! The details of implementation are what really matter. Picking the correct course of action is a form of art, too!)

During the "Data Structures and Algorithms" course last year, the lecturer told a common story about students who tried to make the required assignment: People made up their own algorithms, ended up doing things that were of exponential complexity, and spent hours and hours trying to make the correct implementation. People who picked up an algorithm shown on lectures and made their assignment based on that information made highly efficient programs very quickly and lived happily ever after.

Consider this one, for example: Bubble sort is O(n²) in worst case - sorting 100 items takes 100² = **10000** units of time. Quick sort (that they called the "sign of academic background") is O(n log n) on average - sorting 100 items takes **460.52** units of time. For 1*10^{6} items, the times are 1*10^{12} and 1.3816*10^{7}. Clearly some improvement...

Most beginners will only make fancy versions of bubble sort, so knowing the quick sort algorithm will help a lot. Indeed, if you try to make a better algorithm when you only know how bubble sort works, you may end up creating an algorithm that's even worse than bubble sort.

To illustrate the importance of picking the correct algorithm, let me say that quick sort performs badly on almost-ordered data, but bubble sort is *very* fast in that case.

And the Schneier quote above tells a lot about the importance: If you try to make your own encryption algorithm, you may end up making a very insecure algorithm. To repeat: Don't think you're too smart when the smart guys have already made really cool algorithms. =)