Unit 3 Flashcards
What two factors do computer scientists have to consider when creating an algorithm?
Time (number of steps) and space (memory needed)
What is a heuristic?
A reasonable time algorithm that provides an approximate solution to a problem. It’s “good enough”
- Finding routes between two towns
- Finding files in a list of docs
- Simulated annealing to solve TSP
Heuristic examples
Reasonable or non-reasonable time: O(1)
Reasonable
Reasonable or non-reasonable time: O(n)
Reasonable
Reasonable or non-reasonable time: O(n^2)
Reasonable
Reasonable or non-reasonable time: O(n^c)
Reasonable
Reasonable or non-reasonable time: O(log(n))
Reasonable
Reasonable or non-reasonable time: O(nlog(n))
Reasonable
Reasonable or non-reasonable time: O(c^n)
Non-reasonable
Reasonable or non-reasonable time: O(n!)
Non-reasonable
O(1)
Constant
O(n)
Linear
O(n^2)
Quadradic
O(n^c)
Polynomial
O(log(n))
Logarithmic
O(nlog(n))
Quasilinear
O(c^n)
Exponential
O(n!)
Factorial
True or false: Every problem with an initial condition can be solved in a reasonable amount of time using a modern computer.
False
True or false: Every problem can be solved using a computer and an algorithmic method, but some solutions require much more time than others
False
True or false: To show that a problem is undecidable, you need to show that there exists an instance of the problem that cannot be solved via an algorithm
True
True or false: One can use the Python programming language to create a program that determines whether any program/function and any input will descend into an infinite loop.
False
Suppose you are working on a project that leads to a problem that you and your group determines to be undecidable. What consequences are most likely to be true based on that fact?
There is no algorithm that can definitely solve the problem.