The University of New South Wales
Would-Be Mid-Session Test
2016/09/08
COMP9020
Foundations of Computer Science
(token instructions)
Time allowed: 1 hour + 5 minutes reading time
Total number of questions: 5
Maximum number of marks: 25
All questions are w

COMP9020 Lecture 7
Session 2, 2016
Graphs
Revision: 1.1
1
From Relations to Graphs and Digraphs
Binary relations on sets correspond to directed graphs. Symmetric
relations correspond to undirected graphs.
Terminology (the most common; there are many varia

State Machines
Transition Diagrams
COMP9020 Lecture 8a
Session 2, 2016
State Machines vs Transition Diagrams
Revision: 1.2 of Date: 2016/11/08 04:23:55 UTC
1
State Machines
Transition Diagrams
State Machines
Section 5.4 of the textbook introduces a state

COMP9020 Lecture 8
Session 2, 2016
Order of Growth
Revision: 1.2
1
Problem vs. Algorithm
Intuitively, a problem is a question and an algorithm provides
answers.
In (language) theory wed call a pair P = (I , L) where I for
some alphabet is a set of instanc

COMP9020 Lecture 5
Session 2, 2016
Relations
Revision: 1.2
1
Relations and their representation
Relations are an abstraction used to capture the idea that the
objects from certain domains (often the same domain for several
objects) are related. These obje

COMP9020 Lecture 3
Session 2, 2016
Sets, Functions, and Sequences
Revision: 1.3
1
Divisibility
Let m, n Z.
m|n means m is a divisor of n, defined by n = km for some k Z
(Also stated as: n is divisible by m, m is a divisor of n.)
m - n - negation of m|n
No

COMP9020 Lecture 9
Session 2, 2015
Time Complexity
Revision: 1.3
1
Order of growth of recurrences for algorithms
We want to know what to expect of running time of an algorithm
as the input size goes up. To avoid vagaries of the specific
computational plat

COMP9020 Lecture 11
Session 2, 2016
Conditional Probability
Revision: 1.3
1
Conditional Probability
Definition
The conditional probability of an event E given an event S (of
non-zero probability) is
def
Pr(E |S) =
Pr(E S)
Pr(S)
It defines a probability di

COMP9020 Lecture 9b
Session 2, 2015
Counting and Likelihood
Revision: 1.2
1
Counting Techniques
General idea: find methods, algorithms, and occasional precise
formulae to count the number of elements in various sets or
collections derived, in a structured

COMP9020 Lecture 12
Session 2, 2016
Expectation
Revision: 1.2
1
Random Variables
Random variables (abbr. rv) generalise the notion of a random
event. First of all, they permit separation of the sample spacethe
carrier of probability, and the space of valu

COMP9020 Lecture 12
Session 2, 2016
On the Final Exam
Revision: 1.1
1
What could be in it?
Material from assigned reading, slides, and problems.
We covered topics covered in parts of the textbook chapters 1, 2,
3\cfw_3.4, 4.14.4, 5, 6.1, 6.2, 9.1, 9.2, 9.

COMP9020 Lecture 4-5
Session 1, 2016
Relations
Textbook - Ch. 3, Sec. 3.13.2, 3.4; Ch. 11, Sec. 11.111.2
Problem sets 4 and 5
Supplementary Exercises Ch. 3 and 11 (R & W)
NB
Mid-term test: 22 April
1
Relations and their Representation
Relations are an abs

COMP9020 Lecture 12
Session 1, 2016
Course Review
1
Course Review
Goal: for you to become a competent computer scientist.
Requires an understanding of fundamental concepts:
number-, set-, relation- and graph theory
logic and proofs
recursion and induction

The University of New South Wales
Would-Be Mid-Session Test
2016/09/08
COMP9020
Foundations of Computer Science
(token instructions)
Time allowed: 1 hour + 5 minutes reading time
Total number of questions: 5
Maximum number of marks: 25
All questions are w

Id: prob11.tex,v 1.1 2014/10/14 22:12:30 kaie Exp kaie
Available at the COMP9020 website.
COMP9020 Problem Set 11
Kai Engelhardt
October 22, 2015
1 Probability
Exercise 1 Two dice, one black and one red, are tossed. Let b and r denote their outcomes,
whil

Id: prob05.tex,v 1.2 2016/09/06 00:47:38 kaie Exp kaie
Available at the COMP9020 website.
COMP9020 Problem Set 5
Kai Engelhardt
September 6, 2016
1 Numbers
Exercise 1 Prove the basic properties of gcd carefully.
1. gcd(m, m) = m
2. gcd(m, 0) = m
3. gcd(m,

COMP9020 15s1 Problem Set 7 8 May 15
Induction and Recursion
Exercise 1. Prove by induction that
1 1! + 2 2! + . . . + n n! = (n + 1)! 1
for n 1
Exercise 2. Given the recursive definition,
(B)
(R)
s1 = 1
sn+1 =
1
1+sn
prove by induction that
sn =
fib(n)
f

COMP9020 15s1 Problem Set 2 13 March 15
Solutions
Exercise 1.
First question: Yes. In fact, the conclusion follows directly from just the first requirement.
Second question: No. The third requirement states that the alarm should sound whenever there
is

COMP9020 15s1 Problem Set 1 6 March 15
Numbers, Sets, Functions
Exercise 1. How many numbers divisible by 3, 5, or 7 are there between 100 and 1000?
Exercise 2. Recall Euclids algorithm for the gcd of two positive numbers1 :
if m = n
m
gcd(m, n) = gcd(m n

COMP9020 15s1 Problem Set 5 17 April 15
Relations
Exercise 1. Let P be a partial order on the domain of n elements, and Q its associated quasi-order.
Describe the difference P \ Q (as a subset of S S).
Exercise 2. Define a relation R R R where (a, b) R if

COMP9020 15s1 Problem Set 4 27 March 15
Solutions
Exercise 1.
(a) Yes, since a + 0.5 a a 0.5 for all a R
(b) No; see (a)
(c) Yes, since (b + 0.5 a) (a b 0.5) implies (b a 0.5) (a 0.5 b).
(d) No; e.g. (0, 0.1) R
(e) No; e.g. (1.1, 1.5) R and (1.5, 1.9) R b

COMP9020 15s1 Problem Set 3 20 March 15
Boolean Expressions
Exercise 1. Let 1 = (p (q r), 2 = (s (q p), and = 1 2 .
(a) Draw Karnaugh maps for the three formulae, 1 , 2 , and .
(b) Find a minimal DNF for .
(c) Find a minimal CNF for 1 .
Exercise 2. Portia

COMP9020 15s1 Problem Set 5 17 April 15
Solutions
Exercise 1. P \ Q = cfw_(x, x) : x S (the difference between an order and a quasi-order are just the
reflexive relationships).
Exercise 2.
R is reflexive: for every a, b such that a = b, by definition (a,

COMP9020 Lecture 7
Session 1, 2015
Induction and Recursion
Textbook - Ch. 4, Sec. 4.2, 4.4, 4.6
Problem set 7
Supplementary Exercises Ch. 4 (R & W)
1
Inductive Reasoning
Suppose we would like to reach a conclusion of the form
P(x) for all x (of some type)

COMP9020 Lecture 6
Session 1, 2015
Graphs and Trees
Textbook (R & W) - Ch. 6, Sec. 6.16.5;
Problem set 6;
Supplementary Exercises Ch. 6 (R & W);
A. Aho & J. Ullman. Foundations of Computer Science in C,
p. 522526 (Ch. 9)
1
Concepts Summary for Undirected

COMP9020 Lecture 4-5
Session 1, 2015
Relations
Textbook - Ch. 3, Sec. 3.13.2, 3.4; Ch. 11, Sec. 11.111.2
Problem sets 4 and 5
Supplementary Exercises Ch. 3 and 11 (R & W)
NB
Next lecture: 17 April
Mid-term test: 24 April (covers the material from weeks 1-

COMP9020 Lecture 4-5
Session 1, 2015
Relations
Textbook - Ch. 3, Sec. 3.13.2, 3.4; Ch. 11, Sec. 11.111.2
Problem sets 4 and 5
Supplementary Exercises Ch. 3 and 11 (R & W)
NB
Next lecture: 17 April
Mid-term test: 24 April (covers the material from weeks 1-