Skip to main content Accessibility help
×
Hostname: page-component-76fb5796d-dfsvx Total loading time: 0 Render date: 2024-04-27T01:50:51.865Z Has data issue: false hasContentIssue false

7 - Complexity Theory

Published online by Cambridge University Press:  04 May 2018

David Eppstein
Affiliation:
University of California, Irvine
Get access

Summary

When we find ourselves unable to come up with an efficient algorithm for a computational problem, it is often possible to find an explanation (if not a rigorous proof that the algorithm does not exist) using the techniques of computational complexity theory.

Decision Problems and Complexity Classes

A computational problem can be described by a mathematical specification of its input and of the desired output for each input. This specification does not describe how to compute the output efficiently; that is the task of the algorithm designer. Within complexity theory, a special place is taken by the decision problems, the problems whose output is always either yes or no. A complexity class is a set of decision problems, usually grouped by how much time or memory their algorithms require.

In this theory, three of the most important complexity classes are P, NP, and the class of NP-complete problems.We describe them briefly here; for an accessible and more in-depth treatment, see Fortnow (2013).

  • • P is the class of problems with yes-or-no answers that can be solved by an algorithm whose runtime is polynomial in the number of bits of input. For example, one can test whether a list of points (given by Cartesian coordinates as binary numbers) contains any repeated points, by comparing each pair of points and checking whether they are equal. This algorithm takes time proportional to the square of its input length, a polynomial. It is also possible to solve the same problemmore quickly, using sorting or hashing.

  • • NP is a larger class of yes-or-no problems, not all of which are believed to have efficient algorithms.However, whenever the answer to a problem in NP is “yes,” there must exist a short and easily checked proof that the answer is yes.Many common puzzles, such as sudoku, can be formulated as problems in NP.1 For such puzzles, the yes-or-no question is “does this puzzle have a solution?” or “if I add this step tomy answer, will it still have a solution?” The proof that it does have a solution is the solution itself. Although the solution may be hard to find, it is easy to check that it is valid.

  • Type
    Chapter
    Information
    Publisher: Cambridge University Press
    Print publication year: 2018

    Access options

    Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

    Save book to Kindle

    To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

    Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

    Find out more about the Kindle Personal Document Service.

    • Complexity Theory
    • David Eppstein, University of California, Irvine
    • Book: Forbidden Configurations in Discrete Geometry
    • Online publication: 04 May 2018
    • Chapter DOI: https://doi.org/10.1017/9781108539180.007
    Available formats
    ×

    Save book to Dropbox

    To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

    • Complexity Theory
    • David Eppstein, University of California, Irvine
    • Book: Forbidden Configurations in Discrete Geometry
    • Online publication: 04 May 2018
    • Chapter DOI: https://doi.org/10.1017/9781108539180.007
    Available formats
    ×

    Save book to Google Drive

    To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

    • Complexity Theory
    • David Eppstein, University of California, Irvine
    • Book: Forbidden Configurations in Discrete Geometry
    • Online publication: 04 May 2018
    • Chapter DOI: https://doi.org/10.1017/9781108539180.007
    Available formats
    ×