Algorithms 1. Definition and Complexity Flashcards
What is an algorithm?
An algorithm is a finite sequence of operations for carrying out a procedure or solving a problem.
What may an algorithm be communicated in?
An algorithm may be communicated by using pseudocode or a flowchart.
What is an iterative process?
A repeating process which uses a loop
What is a pass?
Working through the loop once is known as a pass.
How can an algorithm be proved correct using proof by exhaustion?
Proof by exhaustion may be appropriate if the number of possible inputs is small.
How can an incorrect algorithm be disproved?
An incorrect algorithm can sometimes be disproved by counter-example.
What is algorithm complexity?
The study of how algorithms scale in both time and space
It can be used to compare difference algorithms to see which perform better and may also help establish performance expectations for different sized data
Concerns how fast or slow a particular algorithm performs.
What does O(n^2) mean?
Quadratic complexity
This would mean that if n is doubled a computer program would take approximately four times as long to run the algorithm.
What is pseudocode?
Concise instructions that could form the structure of a computer code but have no particular computing language / syntax
-Common sense should be used and applied to instructions
Why are pseudocode written in numbered lines e.g. 10?
Easy reference / adaptation if we want to add step in between e.g. step 15 in-between steps 10 and 20