Algorithms
CSE · Midterm · Summer 26
Paper 2 of 2Batch 69 · Fahad Bin IbrahimSwitch
Batch 69
Paper 2 of 2
Read the questions as text
Read off the PDF by AI, so it may have mistakes. The PDF is the original.
Daffodil International University
Faculty of Science & Information Technology
Department of Computer Science & Engineering
Midterm Examination, Summer 2026
Course Code: CSE213 , Course Title: Algorithms
Level: 2 Term: 1 Batch: 69
Time: 01:30 Hrs
Marks: 25
Answer ALL the Questions
[The figures in the right margin indicate the full marks and corresponding course outcomes. All portions of each question must be answered sequentially.]
1. a) Discuss the trade-off between time complexity and space complexity. Provide examples where increasing memory usage can improve execution time. | 02 | CO1
b) Define and compare Big-O, Big-\Omega, and Big-\Theta notations. Determine the asymptotic complexity of the following function: f(n) = 3n^2 + 5n + 10 | 03
2. a) Analyze the time and space complexity of Quick Sort. Compare its average case performance with Merge Sort. | 02 | CO2
b) Analyze the time complexity of the following code snippet and express it using asymptotic notation: | 1.5*2 = 03
#include <stdio.h>
int main () {
int n; scanf ("%d", &n);
int i = 1;
while(i <= n) {
int j = 1;
while(j <= i * i) {
printf("*");
j ++;
} i ++;
} return 0; }
|
#include <stdio.h>
int main () {
int n;
scanf ("%d", &n);
for (int i = 1; i < n; i*=3) {
for (int j = 1; j < n; j*=3)
printf("Got it \n");
}
return 0;
}
3. a) Design an algorithm for sorting a given set of N integer elements using Insertion sort algorithm and write pseudocode, also analyze its complexity. | 05 | CO3
b) Given coin denominations {2, 5, 10, 15}, design a Greedy algorithm to make change for an amount 118 . Does the greedy strategy work here? Why? | 05
c) Construct a Huffman Tree for the following frequencies: a : 5, c : 9, f : 12, i : 13, l : 16, o : 20, s : 25 and u : 32. Show all steps to send the message "fallacious" using the Huffman Tree and compute total cost. | 05