BIT152 · TU past paper
Discrete Structure 2079 question paper
The complete TU 2079 exam paper for Discrete Structure (BIT152), all 12 questions with solved model answers written to the mark scheme.
Tap a question to open its answer.
- 110 marksPropositions and non-propositionsHideAnswer
Give any four examples that are not propositions. Assume the premises, all over smart persons are stupid, children of stupid persons are naughty, John is over smart, Sam is children of John. Using rules of inferences, show that Sam is naughty.[10]
A proposition is a declarative statement that is either true or false, but not both. The following are not propositions because they are questions, commands, exclamations, or paradoxes with no definite truth value: Example Reason -------...
- 210 marksNumericalInclusion and exclusion principleHideAnswer
Why do we need principle of inclusion and exclusion? How many ways can we express the four character words ending with a digit and beginning three are lowercase alphabets. Be sure that none of the character can be repeated. Using induction, show that $3^n - 1$ is multiple of 2 for $n \geq 1$. [5+5]
- Word length: 4 characters - Positions 1, 2, 3: lowercase alphabets (26 available) - Position 4: a digit (10 available: 0-9) - Constraint: no character repeated - Induction claim: $3^n - 1$ is a multiple of 2 for $n \geq 1$ --- When we ...
- 310 marksNumericalEuler paths and circuitsHideAnswer
State necessary and sufficient conditions for a graph to have Euler path and circuit.Find the GCD of 12 and 18 using Extended Euclidian Algorithm.[4+6]
- Numbers for GCD computation: $a = 12$, $b = 18$ - Required: necessary and sufficient conditions for Euler path and Euler circuit; GCD via Extended Euclidean Algorithm expressing $\gcd$ as a linear combination. No data missing. --- - Eu...
- 45 marksDirect proofHideAnswer
Show that the sum of two even numbers is even using direct proof. [5]
An integer $n$ is even if there exists an integer $k$ such that: $$n = 2k$$ --- Statement: If $a$ and $b$ are even integers, then $a + b$ is also an even integer. --- Assume that $a$ and $b$ are two even integers. Step 1: By the definiti...
- 55 marksNumericalPower setHideAnswer
Define power set. What is the power set of the set A= {1,2, 3, 4}? [5]
Given Data
- Set $A = {1, 2, 3, 4}$
- Number of elements: $n = 4$
STEP 1: Definition of Power Set
The power set of a set $A$ is the set of all subsets of $A$, including the empty set $\emptyset$ and the set $A$ itself.
It is denoted by $P(A)$ or $2^A$.
Key property: If $|A| = n$, then the power set contains $2^n$ subsets, i.e. $$|P(A)| = 2^n$$
STEP 2: Power Set of $A = {1, 2, 3, 4}$
Since $n = 4$, the number of subsets is: $$|P(A)| = 2^4 = 16$$
Listing subsets by size:
Size Subsets 0 $\emptyset$ 1 ${1}, {2}, {3}, {4}$ 2 ${1,2}, {1,3}, {1,4}, {2,3}, {2,4}, {3,4}$ 3 ${1,2,3}, {1,2,4}, {1,3,4}, {2,3,4}$ 4 ${1,2,3,4}$ Count check: $1 + 4 + 6 + 4 + 1 = 16$ ✓ (matches $\binom{4}{0}+\binom{4}{1}+\binom{4}{2}+\binom{4}{3}+\binom{4}{4}$)
Final Answer:
$$ P(A) = {\ \emptyset,\ {1},\ {2},\ {3},\ {4},\ {1,2},\ {1,3},\ {1,4}, $$ $$ {2,3},\ {2,4},\ {3,4},\ {1,2,3},\ {1,2,4},\ {1,3,4},\ {2,3,4},\ {1,2,3,4}\ } $$
Total number of elements in $P(A) = 16$.
- 65 marksOne-to-one correspondenceHideAnswer
Explain one-to-one correspondence with example. What is identity function? [5]
A function f: A → B is called a one-to-one correspondence (also called a bijection) if it is both one-to-one (injective) and onto (surjective). That means: - Injective: Every distinct element in A maps to a distinct element in B. - Forma...
- 75 marksMathematical inductionHideAnswer
Use mathematical induction to prove that the sum of the first n odd positive integers is n2n^2n2. [5]
Claim: The sum of the first n odd positive integers is n². The first n odd positive integers are: 1, 3, 5, 7, ..., (2n - 1). So we want to prove: $$1 + 3 + 5 + \cdots + (2n-1) = n^2$$ --- Left-hand side (LHS): The first odd positive inte...
- 85 marksNumericalRecursively defined functionsHideAnswer
What is recursively defined function? Suppose that f is defined recursively by f(0) = 3, f(n + 1) = 2f (n) +3. Find f(1), f(2), f(3), and f(4). [5]
- Base case: $f(0) = 3$ - Recursive step: $f(n+1) = 2f(n) + 3$ - Required: $f(1), f(2), f(3), f(4)$ A recursively defined function is a function defined in terms of itself, using two components: 1. Base case: the value of the function at...
- 95 marksNumericalArithmetic modulo mHideAnswer
What is arithmetic modulo $m$? Use the definition of addition and multiplication in $\mathbb{Z}m$ to find $7 +{11} 9$ and $7 *_{11} 9$. [5]
STEP 1 - EXTRACT
Given data:
- Modulus: $m = 11$
- Set: $\mathbb{Z}_{11} = {0, 1, 2, \ldots, 10}$
- Compute $7 +_{11} 9$
- Compute $7 *_{11} 9$
All required data present.
STEP 2 - SOLVE
Arithmetic Modulo m
Arithmetic modulo m is arithmetic carried out on the finite set
$$\mathbb{Z}_m = {0, 1, 2, \ldots, m-1}$$
where every result of addition or multiplication is replaced by its remainder upon division by $m$. This keeps all results within the set $\mathbb{Z}_m$ (closure).
Addition in $\mathbb{Z}_m$: $$a +_m b = (a + b) \bmod m$$
Multiplication in $\mathbb{Z}_m$: $$a *_m b = (a \cdot b) \bmod m$$
Compute $7 +_{11} 9$
$$7 +_{11} 9 = (7 + 9) \bmod 11 = 16 \bmod 11$$
Since $16 = 1 \times 11 + 5$:
$$7 +_{11} 9 = 5$$
Compute $7 *_{11} 9$
$$7 *_{11} 9 = (7 \times 9) \bmod 11 = 63 \bmod 11$$
Since $63 = 5 \times 11 + 8$:
$$7 *_{11} 9 = 8$$
Summary
Operation Ordinary result $\bmod 11$ Answer $7 +_{11} 9$ $16$ $16 \bmod 11$ $\mathbf{5}$ $7 *_{11} 9$ $63$ $63 \bmod 11$ $\mathbf{8}$ - 105 marksEquivalence relationsHideAnswer
Define equivalence relation with an example. [5]
A relation R on a set A is called an equivalence relation if and only if it satisfies the following three properties: For every element $a \in A$, we have $(a, a) \in R$. $$\forall a \in A, ; aRa$$ For all $a, b \in A$, if
- 115 marksNumericalGeneralized pigeonhole principleHideAnswer
What is generalized pigeonhole principle. If a class has 24 students, what is the maximum number of possible grading that must be done to ensure that there at least two students with the same grade. [5]
Generalized Pigeonhole Principle
Given Data
- Number of students in class: $24$
- Grading system: standard grades assumed as ${A, B, C, D, F}$, so number of grade categories $k = 5$
- Required: number of gradings needed to guarantee at least two students share the same grade
Note: The number of distinct grades is not stated in the question. The standard university grading scheme with 5 grades (A, B, C, D, F) is assumed. If a different number of grades is intended, the answer changes accordingly.
Definition
Generalized Pigeonhole Principle:
If $N$ objects are placed into $k$ boxes, then at least one box contains at least $\left\lceil \dfrac{N}{k} \right\rceil$ objects.
Basic Pigeonhole Principle (special case): If $N > k$, then at least one box contains at least $2$ objects.
Solution
Here the grades are the pigeonholes and the students are the objects.
We want at least two students in the same grade category, i.e.
$$\left\lceil \frac{N}{k} \right\rceil \geq 2$$
This is guaranteed when
$$N \geq k + 1$$
Worst-case reasoning: Assign grades one by one. The first $5$ students could each receive a different grade (one per category). The very next student ($6^{th}$) must repeat a grade.
With $k = 5$:
$$N = k + 1 = 5 + 1 = 6$$
$$\boxed{\text{At most } 6 \text{ gradings guarantee two students with the same grade}}$$
Interpretation of "24 students"
The class has $24$ students, which far exceeds the $6$ required. So the class of $24$ students certainly contains repeated grades. Indeed, distributing $24$ students among $5$ grades:
$$\left\lceil \frac{24}{5} \right\rceil = \lceil 4.8 \rceil = 5$$
So with all $24$ students, at least one grade is shared by at least $5$ students. But to merely guarantee two students with the same grade, grading only $6$ students suffices.
Answer: The maximum number of gradings needed is $6$ (using $k = 5$ grades). The number $24$ simply confirms a repetition is unavoidable.
- 125 marksDijkstra's algorithm for shortest pathsHideAnswer
Write the Dijkstra's algorithm to find the shortest path between two nodes in graph. [5]
Dijkstra's Algorithm for Shortest Path
Definition
Dijkstra's algorithm is a greedy algorithm that finds the shortest path from a source node to all other nodes (or a specific destination node) in a weighted graph with non-negative edge weights.
Algorithm Steps
DIJKSTRA(Graph G, source s): 1. Initialize: - dist[s] = 0 (distance to source is 0) - dist[v] = ∞ (distance to all other vertices is infinity) - prev[v] = NULL (previous node in optimal path) - Q = set of all vertices (unvisited set / priority queue) 2. While Q is not empty: a. u = vertex in Q with minimum dist[u] (extract-min) b. Remove u from Q c. For each neighbor v of u (still in Q): - alt = dist[u] + weight(u, v) - If alt < dist[v]: dist[v] = alt (relaxation step) prev[v] = u 3. Return dist[], prev[]
Pseudocode (Formal)
function Dijkstra(G, s): for each vertex v in G: dist[v] ← ∞ prev[v] ← UNDEFINED dist[s] ← 0 Q ← all vertices of G while Q ≠ ∅: u ← vertex in Q with min dist[u] remove u from Q for each neighbor v of u: if v ∈ Q: alt ← dist[u] + w(u, v) if alt < dist[v]: dist[v] ← alt prev[v] ← u return dist[], prev[]
Worked Example
Consider the graph:
A --4-- B | | 2 1 | | C --3-- D \ / 5 2 \ / EFind shortest path from A to E.
Step Visited dist[A] dist[B] dist[C] dist[D] dist[E] Init - 0 ∞ ∞ ∞ ∞ 1 A 0 4 2 ∞ ∞ 2 C 0 4 2 5 7 3 B 0 4 2 5 7 4 D 0 4 2 5 7 5 E 0 4 2 5 7 Shortest path: A → C → D → E with cost = 7
Key Properties
Property Detail Time Complexity O(V²) with array; O((V+E) log V) with min-heap Space Complexity O(V) Condition Edge weights must be non-negative Type Greedy algorithm
Important Notes
- The relaxation step (
if alt < dist[v]) is the core operation - Dijkstra's algorithm fails with negative weight edges (use Bellman-Ford instead)
- It produces a shortest path tree rooted at the source node
- The relaxation step (