CMPT-101 Lecture Notes - Lecture 1: The Algorithm
Document Summary
An algorithm is a step-by-step process that will result in a desired outcome. We get steps and the necessary input in order to resolve the issue by following the steps, and not necessarily understand how it is being resolved. A cooking recipe is a good example of this. In a math equation with variables, the algorithm would be the equation itself. The output would be the variable we need to find (x). Steps that are executed in a sequence or in order. The standard form for sequential tasks is 1?2?3. Another way to represent sequential tasks, or algorithms in general, is on a flow chart. Example: finding average kilometres driven in a week. Algorithm calculate total km and then average km. 3 calculate total km (end km minus start km) 4 calculate average (total km divided by 7) Steps that are only executed if a condition is true.