Characteristics of an Algorithm
Definition
An algorithm is a step-by-step procedure or set of rules designed to perform a task to solve a problem.
Clarity
The algorithm's purpose and steps must be clear and readable.
Input and Output
Must have well-defined input and output.
Input can be zero or more inputs.
Output must produce at least one result based on the input.
Finiteness
Must terminate after a finite number of steps; no infinite loops.
Definiteness
Each step is precise and unambiguous; actions lead to a single determined result.
Effectiveness
Steps are basic enough to be carried out by a person with pencil and paper; operations are simple.
Correctness
Produces correct output for all inputs within its defined domain; aligns with objectives.
Generality
Applicable to a wide range of problems or inputs; not limited to a specific case.
Efficiency
Efficient in time and space; aims to minimize time and memory usage; evaluated via time and space complexity.
Language Independence
Implementable in different programming languages; logic remains the same across languages.
Summary
Core characteristics: clarity, finiteness, input, output, and effectiveness; ensures the algorithm solves the problem.