CSC165 · TU past paper
Discrete Structures 2075 question paper
The complete TU 2075 exam paper for Discrete Structures (CSC165), all 12 questions with solved model answers written to the mark scheme.
Tap a question to open its answer.
- 110 marksNumericalMaximal Flows and Minimal CutsHideAnswer
What is S-D cut? For the following network flow find the maximal flow from S to D.[10]
Definition part: No numeric data required. Network flow part: The problem states "the following network," but the actual network diagram (nodes, directed edges, and edge capacities) is NOT reproduced in the text provided to me. Without t...
- 210 marksNumericalComputer Representation of SetsHideAnswer
Consider a set U = {1,2,3,4,5,6,7,8,9,10}. What will be the computer representation for set containing the numbers which are multiple of 3 not exceeding 6? Describe injective, surjective and bijective function with examples.[10]
- Universal set $U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}$ - Required set: numbers that are multiples of 3 not exceeding 6 --- Step 1 - Identify the required set Multiples of 3 that are $\leq 6$: - $3 \times 1 = 3$ ✓ - $3 \times 2 = 6$ ✓ - ...
- 310 marksNumericalProving Correctness of Recursive AlgorithmHideAnswer
Compute the values. 3 mod 4 , 7 mod 5, -5 mod 3 , 11 mod 5 and -8 mod 6Write down the recursive algorithm to find the value of bnb^nbn and prove its correctness using induction.[5+5]
(a) Computing Modular Values For an integer $a$ and positive integer $d$, we write $a \bmod d = r$ where $$a = d \cdot q + r, \qquad 0 \le r < d.$$ The remainder $r$ must be non-negative and strictly less than $d$, so for negative $a$ we...
- 45 marksNumericalSolving Recurrence RelationsHideAnswer
Solve the recurrence relation $a_n = 5a_{n-1} - 6a_{n-2}$, with initial conditions $a_1 = 1$ and $a_2 = 2$. [5]
Solution of Recurrence Relation
Step 1 - Given data
- Recurrence: $a_n = 5a_{n-1} - 6a_{n-2}$
- Initial conditions: $a_1 = 1$, $a_2 = 2$
This is a linear homogeneous recurrence of degree 2 with constant coefficients.
Step 2 - Solve
Characteristic equation
Substitute $a_n = r^n$:
$$r^2 = 5r - 6 \implies r^2 - 5r + 6 = 0$$
Factor:
$$(r-2)(r-3) = 0 \implies r_1 = 2,\ r_2 = 3$$
Distinct roots, so the general solution is:
$$a_n = \alpha_1 \cdot 2^n + \alpha_2 \cdot 3^n$$
Apply initial conditions
For $a_1 = 1$: $$2\alpha_1 + 3\alpha_2 = 1 \quad (i)$$
For $a_2 = 2$: $$4\alpha_1 + 9\alpha_2 = 2 \quad (ii)$$
Multiply $(i)$ by 2: $$4\alpha_1 + 6\alpha_2 = 2 \quad (iii)$$
Subtract $(iii)$ from $(ii)$: $$3\alpha_2 = 0 \implies \alpha_2 = 0$$
From $(i)$: $$2\alpha_1 = 1 \implies \alpha_1 = \tfrac{1}{2}$$
Final solution
$$\boxed{a_n = \tfrac{1}{2}\cdot 2^n = 2^{n-1}}$$
Verification
$n$ $2^{n-1}$ Recurrence 1 1 given 2 2 given 3 4 $5(2)-6(1)=4$ ✓ 4 8 $5(4)-6(2)=8$ ✓ The solution satisfies both the recurrence and initial conditions.
- 55 marksNumericalApplications of Number TheoryHideAnswer
Find the values of x such that x = 1 (mod 5) and x = 2 (mod 7) using Chinese remainder theorem. [5]
$$x \equiv 1 \pmod{5}$$ $$x \equiv 2 \pmod{7}$$ So $a1 = 1$, $m1 = 5$; $a2 = 2$, $m2 = 7$. $\gcd(5, 7) = 1$, so CRT gives a unique solution mod $m = 5 \times 7 = 35$. $$m = 35$$ $$M1 = \frac{35}{5} = 7, \qquad M2 = \frac{35}{7} = 5$$ Fin...
- 65 marksmathematical InductionHideAnswer
Prove that $5^n - 1$ is divisible by 4 using mathematical induction. [5]
We want to prove that 4 (5ⁿ - 1) for all positive integers n, i.e., (5ⁿ - 1) is divisible by 4. --- Substitute n = 1: $$5^1 - 1 = 5 - 1 = 4$$ Since 4 is divisible by 4, the base case holds. --- Assume the statement is true for n = k, i.e...
- 75 marksPropositional LogicHideAnswer
Let A = 'Aldo is Italian' and B = 'Bob is English'. Formalize the following sentences into proposition.a. Aldo isn't Italian.b. Aldo is Italian while Bob is English.c. If Aldo is Italian then Bob is not English.d. Aldo is Italian or if Aldo isn't Italian then Bob is English.e. Either Aldo is Italian and Bob is English, or neither Aldo is Italian nor is Bob English. [5]
Let: - A = 'Aldo is Italian' - B = 'Bob is English' --- This is the negation of A. $$\neg A$$ --- The word "while" expresses that both statements hold simultaneously, so this is a conjunction. $$A \land B$$ --- This is a conditional (imp...
- 85 marksNumericalEuler and Hamiltonian Path and CircuitsHideAnswer
Define Euler path and Hamilton path with examples. Draw the Hasse diagram for the divisibility relation on the set {1,2,5,8,16,32} and find the maximal, minimal, greatest and least element if exist. [5]
Euler Path, Hamilton Path, and Hasse Diagram
Part 1: Euler Path and Hamilton Path
Euler Path
Definition: An Euler path is a walk in a graph that traverses every edge exactly once (vertices may repeat). If it starts and ends at the same vertex, it is an Euler circuit.
Existence condition: A connected graph has an Euler path iff it has exactly 0 or 2 vertices of odd degree (2 odd-degree vertices give an open Euler path; 0 gives an Euler circuit).
Example:
Vertices ${A,B,C,D}$, edges: $A\text{-}B,\ B\text{-}C,\ C\text{-}D,\ D\text{-}A,\ A\text{-}C$.
Degrees: $\deg(A)=3,\ \deg(B)=2,\ \deg(C)=3,\ \deg(D)=2$. Two odd-degree vertices $(A,C)$, so an Euler path exists:
$$A \to B \to C \to D \to A \to C$$
This uses each of the 5 edges exactly once.
Hamilton Path
Definition: A Hamilton path is a path that visits every vertex exactly once. If it returns to the starting vertex, it is a Hamiltonian circuit (cycle).
Note: There is no simple necessary-and-sufficient condition for a Hamilton path (unlike Euler paths).
Example: Same graph as above:
$$A \to B \to C \to D$$
visits all 4 vertices exactly once, so it is a Hamilton path.
Key Difference
Property Euler Path Hamilton Path Visits Every edge once Every vertex once Condition 0 or 2 odd-degree vertices No simple general condition
Part 2: Hasse Diagram for Divisibility on ${1,2,5,8,16,32}$
Step 1: Divisibility relations (a | b)
- $1 \mid$ everything
- $2 \mid 8,\ 2 \mid 16,\ 2 \mid 32$
- $8 \mid 16,\ 8 \mid 32$
- $16 \mid 32$
- $5$: divides nothing else in the set (since $8,16,32$ are not multiples of 5)
Step 2: Cover relations (remove transitive edges)
- $1 \lessdot 2$, $1 \lessdot 5$
- $2 \lessdot 8$ (since $4 \notin$ set)
- $8 \lessdot 16$
- $16 \lessdot 32$
Step 3: Hasse Diagram
32 | 16 | 8 | 2 5 \ / 1Step 4: Maximal, Minimal, Greatest, Least
Minimal element: element with nothing below it. $1$ is the only minimal element.
Maximal elements: elements with nothing above them. $32$ (top of chain) and $5$ (dead-end, divides nothing else). $$\text{Maximal} = {5,\ 32}$$
Least element: divides every element $\Rightarrow$ $1$ divides all. $$\text{Least} = 1$$
Greatest element: must be divisible by all others. $32$ is not divisible by $5$, and no single element is above all others $\Rightarrow$ no greatest element.
Summary Table
Property Element Exists? Minimal ${1}$ Yes Maximal ${5, 32}$ Yes Least $1$ Yes Greatest None No
For the Hasse diagram the minimal element is ${1}$, the maximal elements are ${5,32}$, the least element is $1$ and there is no greatest element. On the Euler path, a route such as $A \to B \to C \to A \to D \to C$ is invalid because it repeats an edge and skips another; the valid path is $A \to B \to C \to D \to A \to C$. The Euler condition should also include the "0 odd vertices" case for completeness.
- 95 marksRandomized AlgorithmsHideAnswer
What does probability testing means? Describe how Fermat's Little Theorem tests for a prime number with suitable example. [5]
Probability testing (also called probabilistic primality testing) is a method of determining whether a given integer is prime, not with absolute certainty, but with a high degree of probability. Instead of checking all possible divisors ...
- 105 marksNumericalPermutations and CombinationsHideAnswer
List any two applications of conditions of probability. You have 9 families you would like to incite to a wedding. Unfortunately, you can only invite 6 families. How many different sets of invitations could you write? [5]
Applications of Conditional Probability and Combination Problem
Given Data
- Total families available: $n = 9$
- Families to be invited: $r = 6$
- Order does not matter (a set of invitations), so this is a combination problem.
Part 1: Two Applications of Conditional Probability
Conditional probability $P(A|B)$ is the probability of event $A$ occurring given that event $B$ has already occurred. Two applications:
-
Medical Diagnosis: Determining the probability that a patient actually has a disease given a positive test result, i.e., $P(\text{Disease} \mid \text{Positive Test})$. This is often computed using Bayes' theorem.
-
Spam Email Filtering: Classifying an email as spam given the presence of certain words, i.e., $P(\text{Spam} \mid \text{Keywords})$. Bayesian spam filters rely on this.
(Other valid examples: weather forecasting, risk assessment in insurance, fault diagnosis in machines.)
Part 2: Combination Problem
Formula
The number of ways to choose $r$ families from $n$ families, without regard to order:
$$C(n, r) = \binom{n}{r} = \frac{n!}{r!,(n-r)!}$$
Solution
$$C(9, 6) = \frac{9!}{6!,(9-6)!} = \frac{9!}{6!,\cdot,3!}$$
Expanding and cancelling $6!$:
$$= \frac{9 \times 8 \times 7 \times 6!}{6! \times (3 \times 2 \times 1)} = \frac{9 \times 8 \times 7}{6} = \frac{504}{6} = 84$$
Conclusion
There are $\boxed{84}$ different sets of invitations that could be written when choosing 6 families out of 9.
- 115 marksSpanning TreesHideAnswer
Define spanning tree and minimum spanning tree, mention the conditions for two graphs for being isomorphic with ean example [5]
--- A spanning tree of a connected graph G is a subgraph T of G that: - Contains all the vertices of G - Is a tree (connected and acyclic) - Has exactly n - 1 edges, where n is the number of vertices In other words, a spanning tree is a ...
- 125 marksProof MethodsHideAnswer
Prove that the product xy is odd if and only if both x and y are odd integers. [5]
Claim: For integers x and y, the product xy is odd if and only if both x and y are odd. --- From the course notes on Integer and Division: - An integer b is odd if it cannot be written as b = 2k for any integer k; equivalently, b = 2k + ...