2.6 Problem Solving

Enduring Understanding

      • There exist problems that computers cannot solve, and even when a computer can solve a problem, it may not be able to do so in a reasonable amount of time.

Essential Questions

      • How can we store data in a program to solve problems?

      • What might happen if you completed the steps in your regular morning routine to get ready and go to school in a different order? How might the reordering affect the decisions you make each morning?

      • How do video games group different actions for a player based on what key is pressed on the keyboard or controller? How do apps group different actions together based on user interaction, such as pressing buttons?

      • What types of problems can be solved more easily with a computer, and what types can be solved more easily without a computer? Why?

Lesson Objectives

  1. For determining the efficiency of an algorithm:

    • Explain the difference between algorithms that run in reasonable time and those that do not.

  2. For determining the efficiency of an algorithm:

    • Identify situations where a heuristic solution may be more appropriate.

  3. Explain the existence of undecidable problems in computer science.

Essential Knowledge

  1. A problem is a general description of a task that can (or cannot) be solved algorithmically. An instance of a problem also includes specific input.

  2. For example, sorting is a problem; sorting the list (2,3,1,7) is an instance of the problem.

  3. A decision problem is a problem with a yes/no answer (e.g., is there a path from A to B?). An optimization problem is a problem with the goal of finding the "best" solution among many (e.g., what is the shortest path from A to B?).

  4. Efficiency is an estimation of the amount of computational resources used by an algorithm. Efficiency is typically expressed as a function of the size of the input.

    • EXCLUSION STATEMENT - Formal analysis of algorithms (Big-O) and formal reasoning using mathematical formulas are outside the scope of this course and the AP Exam.

  5. An algorithm’s efficiency is determined through formal or mathematical reasoning.

  6. An algorithm’s efficiency can be informally measured by determining the number of times a statement or group of statements executes.

  7. Different correct algorithms for the same problem can have different efficiencies.

  8. Algorithms with a polynomial efficiency or lower (constant, linear, square, cube, etc.) are said to run in a reasonable amount of time. Algorithms with exponential or factorial efficiencies are examples of algorithms that run in an unreasonable amount of time.

  9. Some problems cannot be solved in a reasonable amount of time because there is no efficient algorithm for solving them. In these cases, approximate solutions are sought.

  10. A heuristic is an approach to a problem that produces a solution that is not guaranteed to be optimal but may be used when techniques that are guaranteed to always find an optimal solution are impractical.

    • EXCLUSION STATEMENT - Specific heuristic solutions are outside the scope of this course and the AP Exam.

  11. A decidable problem is a decision problem for which an algorithm can be written to produce a correct output for all inputs (e.g., “Is the number even?”).

  12. An undecidable problem is one for which no algorithm can be constructed that is always capable of providing a correct yes- or-no answer.

    • EXCLUSION STATEMENT - Determining whether a given problem is undecidable is outside the scope of this course and the AP Exam.

  13. An undecidable problem may have some instances that have an algorithmic solution, but there is no algorithmic solution that could solve all instances of the problem.