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 27 Jun 2025
Homework 2 only problems 2, 5
(for problem 5, you don't need to use BNF notation)
30 Jun 2025
Homework 3 only problems 2, 3, 4, 5
(for problem 4, the start symbol is <expression>)
30 Jun 2025
Homework 4 only problems 6, 7
(you don't need to give "output" for problem 7)
2 Jul 2025
Homework 5 only problems 4, 5, 7
(for problem 5, only do parts a,b,c (not part d))
7 Jul 2025
Homework 6 only problems 1, 5, 6 7 Jul 2025
Homework 7 only problems 1, 2, 5, 6
(for problem 1, assume 'sound' means 'valid')
9 Jul 2025
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

11 Jul 2025
Homework 9 only problems 1, 2, 6 14 Jul 2025
Homework 10 only problems 6, 7 14 Jul 2025
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.

16 Jul 2025
Homework 12 only problems 1, 7 18 Jul 2025
Homework 13a only problem 1 18 Jul 2025
Homework 13b only problems 2, 3i
(For problem 3,
only complete part i: give a
relational algebra expression)
21 Jul 2025
Homework 14a only problems 1, 2
(for problem 2, only do parts a-e)
23 Jul 2025
Homework 14b only problem 6
(For problem 6,
ignore the Irreflexive
and Asymmetric properties.)
28 Jul 2025
Homework 15a only problems 1, 2 30 Jul 2025
Homework 15b only problems 5, 7 30 Jul 2025
Homework 16a only problems 2gklm, 5
(For problem 2,
only complete parts
g, k, l, and m)
(For problem 5b,
ignore the edge weights)
1 Aug 2025
Homework 16b only problems 7a
(For problem 7,
only complete part a)
1 Aug 2025
Homework 17a only problems 2, 4a
(For problem 4,
only complete part a)
4 Aug 2025
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.)

4 Aug 2025
Homework 18a only problem 3 6 Aug 2025
Homework 18b only problem 4 8 Aug 2025
Homework 18c only problem 6a 8 Aug 2025
Homework 18d only problem 7a 11 Aug 2025
Homework 18e only problem 7c 11 Aug 2025