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.
- Q1.10 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]
- Q2.10 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]
- Q3.10 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]
- Q4.5 marksDirect proofHideAnswer
Show that the sum of two even numbers is even using direct proof. [5]
- Q5.5 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$.
- Q6.5 marksOne-to-one correspondenceHideAnswer
Explain one-to-one correspondence with example. What is identity function? [5]
- Q7.5 marksMathematical inductionHideAnswer
Use mathematical induction to prove that the sum of the first n odd positive integers is n2n^2n2. [5]
- Q8.5 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]
- Q9.5 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]
Given
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.
Solution
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}$ - Q10.5 marksEquivalence relationsHideAnswer
Define equivalence relation with an example. [5]
- Q11.5 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.
- Q12.5 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 (