



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Professor: Bosworth; Class: Algorithm Analysis and Design; Subject: Computer Science; University: Columbus State University; Term: Unknown 1989;
Typology: Study notes
1 / 6
This page cannot be seen from the preview
Don't miss anything!




Definition: An algorithm is a finite set of instructions which, if followed, will accomplish a particular task. In addition every algorithm must satisfy the following criteria: i) input : there are zero or more quantities which are externally supplied; ii) output : at least one quantity is produced; `iii) definiteness : each instruction must be clear and unambiguous; iv) finiteness : if we trace out the instructions of the algorithm, then for all valid cases the algorithm will terminate after a finite number of steps; v) effectiveness : every instruction must be sufficiently basic that it can in principle be carried out by a person using only a pencil and paper. It is not enough that each operation be definite as in (iii), but it must be feasible. [Hor76]
Note the above requirement that an algorithm “in principle be carried out by a person using only a pencil and paper”. This limits the operations that are allowable in a “pure algorithm”. The basic list is: addition and subtraction; multiplication and division; and the operations immediately derived from these. One might argue for expansion of this list to include a few other operations that can be done by pencil and paper. I know an easy algorithm for taking the square root of integers, and can do that with a pencil on paper. However, this algorithm will produce an exact answer for only those integers that are the square of other integers; their square root must be an integer. Operations, such as the trigonometric functions, are not basic operations. These can appear in algorithms only to the extent that they are understood to represent a sequence of basic operations that can be well defined.
Computer Science Definition A heuristic is a procedure, similar to an algorithm, that often produces a correct answer, but is not guaranteed to produce anything. Operations Research Definition Problems are usually optimization problems ; either maximize profits and minimize costs. An algorithm is defined in the sense of computer science (previous slide) with the additional requirement that it always produces an optimal answer. A heuristic is a procedure that often produces an optimal answer, but cannot be proven to do so. NOTE: Both algorithms and heuristics can contain high–level statements that cannot be implemented directly in common programming languages; e.g. “sort the array low–to–high”.
Compute the greatest common divisor of two non–negative integers. For two integers K 0 and N 0, we say that “K divides N”, equivalently “N is a multiple of K”, if N is an integral multiple of K: N = KL. This property is denoted “K | N”, which is read as “K divides N”. The greatest common divisor of two integers M 0 and N 0, denoted gcd(M, N) is defined as follows.