COMPSCI 1MD3 Lecture Notes - Lecture 1: Washing Machine, Flowchart, Euclidean Algorithm
Document Summary
Declarative descriptions: state the properties of the result, describe what the result is, short, but cannot be followed. Imperative descriptions: states how the result is obtained by a given sequence of instructions, each step in the sequence is simple enough that it can be followed. Other examples include: traffic lights, gps directions, cookbook recipes. An algorithm specifies a sequence of instructions to be executed by a machine that, when provided with input will eventually stop and produce some output. Example: a washing machine is built to follow the algorithm of taking water in, letting water out, applying detergent, rotating the drum, and heating the water. The computation prescribed by an algorithm goes through a sequence of states, starting from an initial state and each instruction leading to a new state. The sequence of states is called the trace. An algorithm created by the greek mathematician euclid used to calculate the greatest common divisor of two integer numbers.