• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 3 out of 20 pages
Exam (elaborations)

CS 6515 Algos Test 3 with verified answers

Document preview thumbnail
Preview 3 out of 20 pages

CS 6515 Algos Test 3 with verified answers

Content preview

CS 6515 Algos Test 3 with verified answers

Search Problem - correct answer ✔A search problem is specified by an algorithm C that
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


takes two inputs, an instance I and a proposed solution S, and runs in time polynomial in
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


|I|. We say S is a solution to I if and only if C(I, S) = true
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|




Steps for an NP Proof - correct answer ✔1. Demonstrate that problem B is in the class of
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


NP problems
|!| |!|




2. Demonstrate that problem B is at least as hard as a problem believed to be NP-
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


Complete*. |!|




This is done via reduction from a known problem A (A→B)
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!|




2a. Show how an instance of A is converted to B in polynomial time
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|




2b. Show how a solution to B can be converted to a solution for A, again in polynomial
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


time

2c. Show that a solution for B exists if-and-only-if (IFF) a solution to A exists. You must
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


prove both directions parts:
|!| |!| |!|




|!| - If you have a solution to B you have a solution to A
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|




If there is no solution for B, then no solution exists for A. This may be done via the
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


contra-positive approach, showing that if a solution exists for A then a solution for B must
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


exist
|!|




Reduction - correct answer ✔A reduction from search problem A to search problem B is a
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


polynomial-time algorithm f that transforms any instance I of A into an instance f(I) of B,
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


together with another polynomial-time algorithm h that maps any solution S of f(I) back
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


into a solution h(S) of I; see the following diagram. If f(I) has no solution, then neither
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


does I |!|




Independent Set Definition - correct answer ✔Given a graph G = (V, E) and an integer k, is
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


there a subset
|!| |!| |!|




of vertices S ⊆ V such that | S | ≥ k, and for each edge at most one of its endpoints is
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


in S ?
|!| |!| |!|

,Independent Set Input/Output - correct answer ✔Input: An undirected graph, G = (V, E). A
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


goal g. |!|




Output: The independent set S with size |S| ≥ g, if one exists.
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|




Clique definition - correct answer ✔find a set of g ver- tices such that all possible edges
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


between them are present |!| |!| |!|




Clique Input / Output - correct answer ✔Input: A graph G = (V, E) and a goal, g.
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|




Output: A subset of vertices, S ⊆ V where S is a clique whose size meets the goal, so |S|
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


≥ g.
|!| |!|




Vertex Cover definition - correct answer ✔find b vertices that cover (touch) every edge.
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|




This is a special case of set cover
|!| |!| |!| |!| |!| |!| |!|




Vertex Cover Input/Output - correct answer ✔Input: A graph, G = (V, E) and a budget, b
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|




Output: A set of vertices S ⊂ V that form a vertex cover with a size that is under-budget,
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


so |S| ≤ b.
|!| |!| |!| |!|




Rudrata Cycle Definition - correct answer ✔given a graph, find a cycle that visits each
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


vertex exactly once—or report that no such cycle exists
|!| |!| |!| |!| |!| |!| |!| |!|




Rudrata Cycle Input/Output - correct answer ✔Input: Graph G = (V, E)Output: A cycle that
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


goes through every vertex of the graph exactly once
|!| |!| |!| |!| |!| |!| |!| |!|




Rudrata Path Definition - correct answer ✔given a graph, find a path that visits each vertex
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


exactly once—or report that no such path exists
|!| |!| |!| |!| |!| |!| |!| |!|




Rudrata (s, t)-Path Input/Output - correct answer ✔Input: Graph G = (V, E), Start and End
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


Vertices (s, t) |!| |!|




Output: A path that starts at s, ends at t, and goes through every vertex of the graph
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


exactly once |!|

, Zero-One (0-1) Integer Linear Programming (ILP): Definition - correct answer ✔an approach
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


used for problems that can be set up as linear programs with the additional requirement
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


that some or all of the decision recommendations be integer values
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!|




The unknowns are binary, and only the restrictions must be satisfied.
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!|




Note: General ILP is NP-HARD
|!| |!| |!| |!|




if ILP includes an objective function then it would classify as NP-Hard but not NP-Complete,
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


as we have no known polynomial-time algorithm for validating the solution. By removing
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


the objective function we essentially make it a search problem -- is there a set of values
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


for the variables which satisfy all the constraints? That is easily validated in linear time.
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|




Integer Linear Programming (ILP) Input/Output - correct answer ✔Input: Ax <= b where A is
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


a m x n matrix, b is an m-Vector
|!| |!| |!| |!| |!| |!| |!| |!| |!|




Output: Non-Negative Integer Vector x satisfying the inequality Ax <= b
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!|




SAT Definition - correct answer ✔given a Boolean formula in conjunctive normal form,
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


either find a satisfying truth assignment or else report that none exists.
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|




A satisfying truth assignment is an assignment of false or true to each variable so that
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


every clause contains a literal whose value is true.
|!| |!| |!| |!| |!| |!| |!| |!|




SAT Input/Output - correct answer ✔Input: n clauses with any number of literals in each
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


clause

Output: An assignment of literals that satisfy all the clauses of the input
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|




3SAT definition - correct answer ✔given a Boolean formula in conjunctive normal form with
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


at most 3 variables in each clause, either find a satisfying truth assignment or else report
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|


that none exists.
|!| |!| |!|




3SAT Input/Output - correct answer ✔Input: n clauses with at most 3 unique literals each
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|




Output: An assignment if literals that satisfy all the clauses of the input
|!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!| |!|

Document information

Uploaded on
February 11, 2025
Number of pages
20
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$18.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Ruiz
3.2
(15)
Sold
107
Followers
4
Items
14206
Last sold
1 day ago




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions