An algorithm is defined as a finite set of steps that guarantees an optimal solution to a problem in a finite amount of time. An example algorithm for finding the average of two numbers in the C programming language is given, with 4 steps. The key characteristics of algorithms are that they have an input, produce an output, terminate in a finite number of steps, have definite unambiguous steps, and provide enough information at each step to produce results. Performance of algorithms is measured by time complexity and space complexity, with time complexity usually being more important. Good algorithms should run in less time and use less memory.