Introduction to algorithms Flashcards
1
Q
What is an algorithm?
A
An algorithm is a specific set of steps of a finite number required to solve a specific problem or provide a solution to said problem.
2
Q
What are the characteristics or properties of an algorithm?
A
The are various properties that every algorithm requires.
Acronym: FIGED
- Finiteness
->Every algorithm must have a finite or specific number of steps. - Input/Output
->Every algorithm must take in zero or more inputs but must always produce some sort of output. - Generality
->Every algorithm must be able to take in every value in its valid set of inputs and produce the required outputs. - Effectiveness
->Each step of an algorithm must be easily translatable and applicable to a programming language. - Definiteness
-> Each step of an algorithm must be clearly and stated, to make them easy to understand and easy to impliment.
3
Q
What are the different categories of algorithms/
A
- Selective Algorithms:
-> These are algorithms that involve some sort of decision-making, not every instruction in these algorithms is executed as certain instructions are executed depending on whether or not a particular condition is fulfilled. - Sequential Algorithms
-> In algorithms of this nature every instruction within them is executed one after another and every instruction is executed once. - Iterative Algorithms
-> These algorithms contain an instruction or set of instructions that are repeated multiple times.