0% found this document useful (0 votes)
239 views

Assignment Solution CS701

The document contains instructions for assignments for the course CS701 - Theory of Computation at Virtual University of Pakistan. It states that [1] cheating will result in zero marks, [2] students found cheating twice will receive an F grade, and [3] no assignments will be accepted after the due date. It then provides examples of three questions - finding subsets of a set with nonnegative sum, proving a scheduling problem can be solved in three slots, and determining if a formula is satisfiable - as practice problems for the assignments.

Uploaded by

Hasnain Haider
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
239 views

Assignment Solution CS701

The document contains instructions for assignments for the course CS701 - Theory of Computation at Virtual University of Pakistan. It states that [1] cheating will result in zero marks, [2] students found cheating twice will receive an F grade, and [3] no assignments will be accepted after the due date. It then provides examples of three questions - finding subsets of a set with nonnegative sum, proving a scheduling problem can be solved in three slots, and determining if a formula is satisfiable - as practice problems for the assignments.

Uploaded by

Hasnain Haider
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Virtual University of Pakistan

Fall 2018

CS701 – Theory of Computation

Assignment 3

Instructions to Solve Assignments

The purpose of the assignments is to give students hands on practice. It is expected that
students will solve assignments themselves. Following rules will apply during the
evaluation of the assignment.

 Cheating from any source will result in zero marks in the assignment.
 Any student found cheating in any two of the assignments submitted during the
course will be awarded "F" grade in the course.
 No assignment after due date will be accepted.

1
Virtual University of Pakistan
Fall 2018

Question 1 (15 Marks)


Let subset sum is the sum of the numbers in a subset of a set. For the following set S, find
all the subsets whose subset sum is nonnegative.
S = {-4, -1, 2, 3}

Solution:

Sr. No. Subset Subset


Sum
1 {} 0
2 {-4} -4
3 {-1} -1
4 {2} 2
5 {3} 3
6 {-4, -1} -5
7 {-4, 2} -2
8 {-4, 3} -1
9 {-1, 2} 1
10 {-1, 3} 2
11 {2, 3} 5
12 {-4, -1, 2} -3
13 {-4, -1, 3} -2
14 {-4, 2, 3} 1
15 {-1, 2, 3} 4
16 {-4, -1, 2, 3} 0

Subsets with nonnegative Subset Sum


{}, {2}, {3}, {-1, 2}, {-1, 3}, {2, 3}, {-4, 2, 3}, {-1, 2, 3}, {-4, -1, 2, 3}
09 subsets

Question 2 (20 Marks)


Let
SCHEDULE = {<F, S, h> | F is a list of final-exams, S is a list of subsets
specifying the final-exams each student is taking, and final-exams can be
scheduled into h slots so that no student is taking two exams in the same slot}.

If A = {F', S', 3}
where F'= {1, 2, 3, 4, 5, 6, 7, 8, 9},
S' = {{1, 3}, {1, 4}, {1, 8}, {1, 9}, {2, 4}, {2, 5}, {2, 6}, {2, 7}, {2, 9},
{3, 4}, {3, 7}, {4, 5}, {5, 7}, {5, 8}, {6, 7}, {6, 8}, {6, 9}, {7, 8}}

Prove that A ∈ SCHEDULE.

Solution:

2
Virtual University of Pakistan
Fall 2018

We prove that A ∈ SCHEDULE by giving a schedule with h = 3 slots such that no student
is taking two exams in the same slot
h Final-exams
1 1, 5, 6
2 2, 3, 8
3 4, 7, 9

Question 3 (15 Marks)


Let
3SAT = {<𝜙> | 𝜙 is a satisfiable 3cnf-formula}

𝜓 = (𝑥1 ∨ 𝑥2 ∨ 𝑥3 ) ∧ (𝑥
̅̅̅1 ∨ ̅̅̅
𝑥2 ∨ ̅̅̅)
𝑥3 ∧ (𝑥
̅̅̅1 ∨ 𝑥
̅̅̅2 ∨ 𝑥3 ) ∧ (𝑥
̅̅̅1 ∨ 𝑥2 ∨ 𝑥
̅̅̅)
3 ∧ (𝑥1 ∨ ̅̅̅
𝑥2 ∨ 𝑥
̅̅̅)
3 ∧
(𝑥1 ∨ 𝑥2 ∨ ̅̅̅)
𝑥3

Does 𝜓 belong to 3SAT? Justify your answer.

Solution:
𝜓 has two satisfying assignments: x1 = 1, x2 = 0, x3 = 0 and x1 = 0, x2 = 1, x3 = 0
Hence 𝜓 belong to 3SAT.

You might also like