in other words a computer program is a specific implementation of an algorithm or set of algorithms designed to be used in conjunction with computer hardware (and possibly other programs) to solve a problem whereas an algorithm does not define the way it is to be implemented (though specific algorithms might by their nature suggest specific implementations).
Making a cake algorithm: get ingredients. combine ingredients put in pan bake in oven let cool frost.
making a cake recipie/program. you will need 2cups flour, 2 cups sugar, 1tsp baking soda... sift together dry ingredients into a large bowl. fold in liquid ingredients, and stir until moist. beat another 2 minutes on high. pour into 2 10" round cake pans bake in 375 degree oven for 25-30 minutes take out of pan and let cool on cooling racks ..etc.
notice that the algorithm is VERY general, but gives you the idea of what is involved, what steps are required (and sometimes what NOT to do). it's enough to let you know if you can do it, what it might require.
the recipie/program is for making a specific kind of cake, and will actually produce one. it's VERY detailed, with no room for playing around (ok, so baking isn't the perfect analogy).
Every cake recipie will "implement" the cake algorithm, but slightly differently, giving slightly different results.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Joined: Oct 14, 2003
Would a computer program be a kind of an algorithm since programs implement algorithms?
I'm sorry to muddy the waters, but for years ALGOL was used more as a format for publishing algorithms than as a language for programming an actual computer.
I think that a computer program is a kind of algorithm.
Some algorithms are compilable/executable programs, some algorithms are written in a computer programming language but wouldn't run as written, some algorithms are written in pseudocode such as found in CLRS, and some algorithms are written as mathematical formulas and/or in natural language.
TopCoder www.topcoder.com devides their ranking system into categories, and Algorithims has it's own category. This just illistrates the point that you can be a wiz at solving problems using algorithims and not be an expert programmer.
In addition to above, Algorithm is a set of finite number of statements which is designed to end in a finite amount of time where as in a program the ending is not guaranteed. It might run infinitely(ex: infinite while loop).