CS 415, Section 001 Sonoma State University Spring, 2023
 
Algorithm Analysis
Instructor: Henry M. Walker

Lecturer, Sonoma State University
Professor Emeritus of Computer Science and Mathematics, Grinnell College

Although much of this course is well developed, some details can be expected to evolve as the semester progresses.
Any changes in course details will be announced promptly during class.

Worksheet on Classes P and NP

Classes P and NP

  1. Consider the terms, "Class P", "Class NP", tractable, and intractable.
    Give careful definitions of each of these terms.

  2. One approach for sorting an array of n elements is to generate all n! permutations of the elements and then each is examined to determine which permutation is ordered.

    1. Explain why this algorithm, called a Permutation Sort, has Θ(n * n!).
    2. Since n * n! is not a polynomial, must we conclude that sorting is not in Class P? Explain briefly.
    3. Does this or another analysis prove that sorting is in Class NP? Explain.
  3. Consider a breadth-first or a depth-first traversal of a directed graph with n vertices.

    1. Does either of these algorithms demonstrate that the problem of traversing a graph is in Class P? Explain.
    2. Does either of these algorithms demonstrate that the problem of traversing a graph is in Class NP? Explain.
  4. Identify 3 problems in Class P, and explain why each is in Class P.

  5. Use the definition of Class NP to explain why each of the following problems is in Class NP.

    1. The Hamiltonian Path problem.
    2. The Satisfiability Problem, which asks whether there is an assignment of True or False to each of the n variables in a Boolean expression, so that the resulting expression is True.
created April 25, 2022
revised April 25, 2022
revised July 25, 2022
revised December 31, 2022
revised April 24, 2023
Valid HTML 4.01! Valid CSS!
For more information, please contact Henry M. Walker at walker@cs.grinnell.edu.