When a program's time is plotted on log-log paper, the curve is not a straight line, but curves upward. The program is probably:

  • A: O(n)
  • B: O(n log n)
  • C: O(n2)
  • D: O(n3)
  • E: O(2n)

    Answer: E

    Polynomial-time programs (those whose Big O is O(nk) for some constant k) will plot as straight lines on log-log paper. A factor of log n will probably not be noticeable.

    If a program's time curves upward on a log-log plot, it is probably intractable, exponential, NP-complete, O(2n), and very bad news: unless your problem is very small, you will not be able to solve it with any amount of computers.

    However, some important NP-complete problems have polynomial-time approximate solutions that are pretty good.

    Prev    Next    Page+10