CS2
Week 5: Algorithm analysis, searching, sorting
12
Hard problems
nIf a polynomial time algorithm exists for a problem it is generally considered to be ‘well solved’ (polynomial functions are functions where the powers are constants, e.g. n5 + n3). A polynomial solution means some method has been found to solve a problem that is better than just ‘blind guessing’ (technically known as exhaustive search).
nAlgorithms that ‘just guess’ typically have an exponential growth rate in n (e.g. 2n). As n grows such problems quickly become too large to solve. An example of such an algorithm would be to sort a list by randomly rearranging elements and then testing the list to see if it is in order. If we had no insight into how to sort a list this would be our best approach.
nResearch in computer science has revealed several categories of ‘hard’ problem:
–Undecidable problems (i.e. cannot be solved)
n Nondeterministically’ intractable
–‘Nondeterministically’ polynomial (NP)
n