Computer Science 236

CS 236 Homework Assignments


Homework assignments are due by the 11:00 pm on the due date.

Please upload a PDF file containing your solutions to Learning Suite.

Late submissions are not accepted.

Email submissions are not accepted.


Assignment Assigned Problems Due Date
Homework 1 only problems 3, 4 17 Jan 2024
Homework 2 only problems 2, 5 22 Jan 2024
Homework 3 only problems 2, 3, 4, 5 24 Jan 2024
Homework 4 only problems 6, 7
(you don't need to give "output" for problem 7)
26 Jan 2024
Homework 5 only problems 4, 5, 7
(for problem 5, only do parts a,b,c (not part d))
31 Jan 2024
Homework 6 only problems 1, 5, 6 2 Feb 2024
Homework 7 only problems 1, 2, 5, 6
(assume 'sound' means 'valid')
5 Feb 2024
Homework 8 Problem 1.

Use mathematical induction to prove
(for all integers n > 0):
P(n): 1 + 3 + 6 + ... + n(n+1)/2 = n(n+1)(n+2)/6

Problem 2.

Use mathematical induction to prove
(for all integers n > 0):
P(n): 1*1! + 2*2! + ... + n*n! = (n+1)! - 1

9 Feb 2024
Homework 9 only problems 1, 2, 6 14 Feb 2024
Homework 10 only problems 6, 7 16 Feb 2024
Homework 11 Problem 1.

Consider the following facts, rules, and queries.

Facts:
  child('Jill','Zed').
  child('Ned','Bea').
  child('Tim','Jack').
  child('Sue','Jack').
  child('Anne','Jill').
  child('Lou','Jane').
  child('Mary','Tim').
  child('Ron','Dan').
  child('Anna','Kim').
  child('Tim','Jill').
  child('Mary','Jane').
  child('Jill','Bea').

Rules:
  ancestor(X,Y) :- child(Y,X).
  ancestor(X,Y) :- child(Y,Z), ancestor(X,Z).

Queries:
  ancestor('Zed','Mary')?

a. Write the rules as clauses (disjunctions of literals).

b. Write one formal proof of the query using proof-by-contradiction, instantiation, and resolution. Give a justification for each line in your proof. Each step must be a premise or the result of instantiation or resolution.

21 Feb 2024
Homework 12 only problems 1, 7 1 Mar 2024
Homework 13a only problem 1 4 Mar 2024
Homework 13b only problems 2, 3i
(For problem 3,
only complete part i: give a
relational algebra expression)
6 Mar 2024
Homework 14a only problems 1, 2
(for problem 2, only do parts a-e)
11 Mar 2024
Homework 14b only problem 6
(For problem 6,
ignore the Irreflexive
and Asymmetric properties.)
13 Mar 2024
Homework 15a only problems 1, 2 20 Mar 2024
Homework 15b only problems 5, 7 22 Mar 2024
Homework 16a only problems 2gklm, 5
(For problem 2,
only complete parts
g, k, l, and m)
(For problem 5b,
ignore the edge weights)
25 Mar 2024
Homework 16b only problems 7a
(For problem 7,
only complete part a)
27 Mar 2024
Homework 17a only problems 2, 4a
(For problem 4,
only complete part a)
29 Mar 2024
Homework 17b Problem 1.

Consider the directed graph with nodes V and edges E. A diagram of the graph is provided at this link: Graph

V = { a, b, c, d, e, f }
E = { (a,b), (b,d), (c,b), (d,a), (e,d), (e,f), (f,e) }

Follow parts a-d below to show the steps of finding the strongly connected components in the graph.

a. Draw the diagram for the reverse-edge graph.

b. Draw the DFS-forest for the reverse-edge graph. (When there is a choice of nodes to visit, choose the one that is first in alphabetic order.)

c. Give the postorder numbers for the nodes in the reverse-edge graph. Assign numbers starting with the number 1.

d. Draw the DFS-tree for each strong component in the order it is found. (When there is a choice of nodes to visit, choose the one that is first in alphabetic order.)

1 Apr 2024
Homework 18a only problem 3 5 Apr 2024
Homework 18b only problem 4 8 Apr 2024
Homework 18c only problem 6a 10 Apr 2024
Homework 18d only problem 7a 12 Apr 2024
Homework 18e only problem 7b 15 Apr 2024