Chapter 5: Algoithms Flashcards
1
Q
Formal definition of algorithm
A
An algorithm is an ordered set of unambiguous, executable steps that define a terminating process.
2
Q
Algorithm representation
Primitives:
Programming language:
A
- Primitives: a well-defined set of building blocks from which algorithm representation can be constructed.
- Programming language: a collection of primitives along with a collection of rules stating how the primitives can be combined.
3
Q
What is a flow chart?
A
A flow chart is a picture of the separate steps of a process in a sequential order
4
Q
What’s pseudo code?
A
It’s a notational system in which algorithms can be expressed (less formal than real programming language code)
5
Q
Loop control
A
- Initialize : establish an initial state
- Test: continue only if the current state fulfills the loop condition
- Modify: change the state towards a termination state
6
Q
Iterative structures
A
- Pre test loop: 0 try if condition false
- Post test loop: 1 try if condition false
7
Q
Insertion sort
A
- Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time.
8
Q
Recursion
A
- The execution of a procedures leads to another execution of the procedure
- Multiple activations of the procedure are formed, all but one of which are waiting for other activations to complete.
- Recursion is a function or method that has the ability of calling itself to solve the problem
9
Q
Algorithm efficiency
A
- Measured as number of instructions executed
- Big theta O with a - in it (and Big O) notation is used to represent efficiency classes:
- insertion sort is Big theta(n^2)
- sequential search is Big theta(n)
- binary search is Big theta(log n)
10
Q
Software verification
A
- Static verification (code analysis) and testing