What is Algorithm?
{{nosources|date=June 2024}} An '''algorithm''' is a list of steps that can be followed to solve a problem using a limited number of steps. For example, a [[recipe]] is an algorithm to prepare a dish in a limited amount of time. The words 'algorithm' and 'algorism' come from the name of a Persian [[mathematician]] called [[Al-Khwārizmī]] ([[Persian language|Persian]]: خوارزمی, <abbr>c.</abbr> 780–850). In computing, an algorithm is a precise list of operations that could be done by a [[Turing machine]]. For the purpose of computing, algorithms are written in [[pseudocode]], [[Flow chart|flow charts]], or [[Programming language|programming languages]]. == Comparing algorithms == There is usually more than one way to solve a problem. There may be many different recipes to make a certain dish which looks different but ends up tasting the same when all is said and done. The same is true for algorithms. However, some of these ways will be better than others. If a recipe needs lots of complicated ingredients that you do not have, it is not as a good as a simple recipe. When we look at algorithms as a way of solving problems, often we want to know how long it would take a computer to solve the problem using a particular algorithm. When we write algorithms, we like our algorithm to take the least amount of time so that we can solve our problem as quickly as possible. In cooking, some recipes are more difficult to do than others, because they take more time to finish or have more things to keep track of. It is the same for algorithms, and algorithms are better when they are easier for the computer to do. The thing that measures the difficulty of an algorithm is called ''complexity''. When we ask how complex an algorithm is, often we want to know how long it will take a computer to solve the problem we want it to solve. == Sorting == This is an example of an algorithm for sorting [[card]]s with colors on them into piles of the same color: # '''Pick up all of the cards.''' # Pick a card from your hand and look at t