Coconote
AI notes
AI voice & video notes
Export note
Try for free
Characteristics of an Algorithm
Jul 30, 2024
Characteristics of Algorithms
Input
Algorithms can take zero or more inputs.
Input is necessary but not mandatory for every algorithm.
Example: Like a C language function which may not take parameters but does something.
Output
Algorithms must generate at least one output.
Output is essential for the usability of the algorithm.
It's analogous to a function that must return some result, even if it's void.
Definiteness
Each statement in an algorithm should be unambiguous and have a single, exact meaning.
Statements should be clear and understandable so that they can be solved.
Example: You cannot use values that are imaginary (like root minus 1) without defining them properly.
Finiteness
An algorithm must have a finite number of steps and terminate at some point.
Algorithms are different from services like database or web servers which run continuously.
Example: A function with limited steps that stops and returns a result.
Effectiveness
Each statement in the algorithm should serve a purpose and do something useful.
Avoid unnecessary steps in the algorithm, similar to procedures in experiments or cooking recipes.
Analogies to Understand Characteristics
Procedure Example
: Chemistry or physics experiments, and cooking recipes.
Input
: Chemicals for experiments, instruments for physics, ingredients for cooking.
Output
: A solution in experiments, a prepared dish in cooking.
Definiteness
: Known steps, no magic.
Finiteness
: Procedure stops at some point.
Effectiveness
: Only necessary steps are performed.
📄
Full transcript