Lecture 1 Flashcards
1
Q
Name the most important problem types
A
Sorting, searching, string processing, graph, geometric, combinatorial and numerical problems
2
Q
What is a loop variant?
A
a logical predicate such that if it is satisfied before entering any single iteration of the loop then it is also satisfied after the iteration
3
Q
What are the three components of a loop variant
A
Initialization: It is true prior to the first iteration of the loop.
Maintenance: If it is true before an iteration of the loop, it remains true before the next iteration.
Termination: When the loop terminates, the invariant gives us a useful property that helps show that the algorithm is correct.