Design and Analysis of Algorithms (BSc CSIT, CSC314): the questions likely to come
33 analyzed questions from 8 past papers (2074-2082), grouped by syllabus unit — each with its probability, how often it's been asked, and where to study the answer.
Define minimum spanning tree. Write Kruskal's algorithm to find the MST of a connected weighted graph, illustrate it with an example and analyze its complexity.
Minimum Spanning Tree (MST)
Given a connected, undirected, weighted graph , a spanning tree is a subgraph that is a tree connecting all vertices using exactly edges. A Minimum Spanning Tree is a spanning tree whose total edge weight is minimum among all spanning trees.
Kruskal's Algorithm
Kruskal's algorithm is a greedy algorithm. It repeatedly picks the smallest-weight edge that does not form a cycle, using a disjoint-set (Union-Find) structure to detect cycles.
KRUSKAL(G):
A = {} // edges of MST
for each vertex v in V: MAKE-SET(v)
sort edges of E in non-decreasing order of weight
for each edge (u,v) in sorted order:
if FIND-SET(u) != FIND-SET(v): // adding edge does not form a cycle
A = A union {(u,v)}
UNION(u, v)
return A
Example
Consider a graph with vertices and edges: .
Process edges in increasing order:
| Edge | Weight | Action |
|---|---|---|
| AB | 1 | Add (no cycle) |
| BC | 2 | Add (no cycle) |
| AC | 3 | Reject (A,C already connected) |
| CD | 4 | Add (no cycle) |
| BD | 5 | Reject (B,D connected) |
| DE | 6 | Add (no cycle) |
MST edges = , total weight , with edges.
Complexity Analysis
- Sorting the edges: .
- MAKE-SET and at most FIND/UNION operations with union by rank + path compression: , nearly linear.
- Total: (since , ).
Correctness follows from the greedy cut property: the lightest edge crossing any cut is safe to add to the MST.
Greedy Algorithms
Define minimum spanning tree. Write Kruskal's algorithm to find the MST of a connected weighted graph, illustrate it with an example and analyze its complexity.
Explain the job sequencing with deadlines problem and solve it using the greedy approach for a given set of jobs.
Explain the greedy method of algorithm design. Generate the prefix code for the string "CYBER CRIME" using Huffman algorithm and find the total number of bits required to encode it.
Write a greedy algorithm for the fractional knapsack problem and analyze its time complexity.
Write Dijkstra's algorithm to find single-source shortest paths and explain it with an example.
How do you define optimal solution? Does greedy algorithm always guarantee optimal solution? Given the string "SUPER DUPER CSIT", use a Greedy algorithm to build a Huffman tree.
Sit a probable paper
A full mock exam built from the most likely questions, mirroring the real paper's structure. Every slot is a real past question.
Most Probable Paper
Mirrors the real structure · 60 marks · based on 8 past papers
- 1.[10 marks]
Define minimum spanning tree. Write Kruskal's algorithm to find the MST of a connected weighted graph, illustrate it with an example and analyze its complexity.
This question has recurred in 3 of 8 years; so far only in internal assessments, not the board; and its topic (Greedy Algorithms) appears in 100% of years.
- 2.[10 marks]
Explain the greedy method of algorithm design. Generate the prefix code for the string "CYBER CRIME" using Huffman algorithm and find the total number of bits required to encode it.
This question has recurred in 3 of 8 years; so far only in internal assessments, not the board; and its topic (Greedy Algorithms) appears in 100% of years.
- 3.[10 marks]
Define asymptotic notations (Big-O, Big-Omega, Big-Theta). State the master theorem and use it to solve the recurrences T(n)=3T(n/2)+n and T(n)=2T(n/4)+sqrt(n).
This question has recurred in 3 of 8 years; so far only in internal assessments, not the board; and its topic (Foundations of Algorithm Analysis) appears in 88% of years.
- 1.[5 marks]
Explain the job sequencing with deadlines problem and solve it using the greedy approach for a given set of jobs.
This question has recurred in 5 of 8 years; so far only in internal assessments, not the board; and its topic (Greedy Algorithms) appears in 100% of years.
- 2.[5 marks]
Write a greedy algorithm for the fractional knapsack problem and analyze its time complexity.
This question has recurred in 5 of 8 years; so far only in internal assessments, not the board; and its topic (Greedy Algorithms) appears in 100% of years.
- 3.[5 marks]
Write Dijkstra's algorithm to find single-source shortest paths and explain it with an example.
This question has recurred in 5 of 8 years; so far only in internal assessments, not the board; and its topic (Greedy Algorithms) appears in 100% of years.
- 4.[5 marks]
Solve the recurrence relation T(n) = 2T(n/2) + n using the substitution method and the recursion tree method.
This question has recurred in 5 of 8 years; so far only in internal assessments, not the board; and its topic (Foundations of Algorithm Analysis) appears in 88% of years.
- 5.[5 marks]
Differentiate between Breadth First Search (BFS) and Depth First Search (DFS) with examples and their time complexities.
This question has recurred in 5 of 8 years; so far only in internal assessments, not the board; and its topic (Foundations of Algorithm Analysis) appears in 88% of years.
- 6.[5 marks]
Explain heap sort algorithm with an example and analyze its time complexity.
This question has recurred in 5 of 8 years; so far only in internal assessments, not the board; and its topic (Divide and Conquer Algorithms) appears in 100% of years.
- 7.[5 marks]
What are approximation algorithms? Explain the approximation algorithm for the vertex cover problem.
This question has recurred in 5 of 8 years; so far only in internal assessments, not the board; and its topic (Number Theoretic, Computational Geometry and NP-Completeness) appears in 100% of years.
- 8.[5 marks]
Explain how the subset-sum problem is solved using backtracking with an example.
This question has recurred in 5 of 8 years; so far only in internal assessments, not the board; and its topic recurs in 6 of 8 years.
- 9.[5 marks]
Explain the naive string matching algorithm and the Rabin-Karp algorithm with their time complexities.
This question has recurred in 4 of 8 years; so far only in internal assessments, not the board; and its topic (Foundations of Algorithm Analysis) appears in 88% of years.
Behind the numbers
The raw evidence the predictions are computed from: marks per unit per year, syllabus weights, trends, and coverage.
Show the heatmap, topic table and coverage analysis
The receipt: marks per unit, per year
Each row is a syllabus unit, each column an exam year, each cell the marks that unit earned that year. Click any cell to see the actual questions behind it.
| # | Syllabus unit | Probability | Appeared | Avg marks | Syllabus weight | Exam vs syllabus | Trend | Questions |
|---|---|---|---|---|---|---|---|---|
| 1 | U4Greedy Algorithms | Very likely100% | 18.1 | 16%7 lecture hrs | Over-examinedexam 24% · syllabus 16% | Fading | 5 recurring6 total | |
| 2 | U1Foundations of Algorithm Analysis | Very likely88% | 15 | 11%5 lecture hrs | Over-examinedexam 18% · syllabus 11% | Rising | 4 recurring5 total | |
| 3 | U3Divide and Conquer Algorithms | Very likely100% | 10 | 16%7 lecture hrs | Balancedexam 13% · syllabus 16% | Steady | 3 recurring5 total | |
| 4 | U7Number Theoretic, Computational Geometry and NP-Completeness | Very likely100% | 9.4 | 18%8 lecture hrs | Under-examinedexam 12% · syllabus 18% | Rising | 2 recurring6 total | |
| 5 | U5Dynamic Programming | Likely75% | 15.8 | 18%8 lecture hrs | Balancedexam 16% · syllabus 18% | Steady | 4 recurring6 total | |
| 6 | U6Backtracking | Likely75% | 12.5 | 11%5 lecture hrs | Balancedexam 12% · syllabus 11% | Fading | 3 recurring3 total | |
| 7 | U2Iterative Algorithms | Likely62% | 5 | 11%5 lecture hrs | Under-examinedexam 4% · syllabus 11% | Rising | 1 recurring2 total |
Study smart, not hard
Drag the slider: studying the top 5 units in priority order covers ~83% of all observed marks.
- ~80% line
Lecture time vs exam marks
Where the exam pays more than the curriculum spends: ● lectures vs ● exam marks, as a share of the whole course. A long teal-leading bar = high-yield unit.