Attributes of Algorithms
The minimal set of primitives needed in order to express
any algorithm:
-
Integer variables.
-
Arithmetic.
-
Ability to sequentially execute statements, which include
assignment, selection (if), and iteration (i.e. looping: repeat).
Attributes we are interested with respect to algorithms:
-
First and foremost is correctness. Algorithms can be incorrect
for a variety of reasons:
-
Correct results for the wrong problem.
-
Correct results only for expected inputs; incorrect otherwise.
-
Unacceptable (lack of) accuracy.
An algorithm/(sub)program is correct if, for all possible
inputs that satisfy its
preconditions, it terminates
with an output that satisfies its postconditions.
-
Easy to understand (the maintenance issue).
-
Elegant
-
Efficient