CSE1305 -- Exam Pattern Analysis

Based on 16 past exams (2018--2025): 5 Midterms, 6 Endterms, 5 Resits

34
Distinct Patterns
16
Exams Analyzed
~329
Total Questions
2018--2025
Year Range
Appears in 10+ exams
Appears in 5--9 exams
Appears in 1--4 exams
MID Midterm
END Endterm
RES Resit

Table of Contents

  1. Asymptotic Notation Concepts (Big-O / Ω / Θ)
  2. Sorting Algorithm Properties & Comparisons
  3. Closed Form Derivation by Repeated Unfolding
  4. Recurrence Relation Setup (Base & Recursive Case)
  5. Heap Operations & Heap Sort
  6. Array vs Linked List Complexity Comparison
  7. Dynamic Array Resizing & Amortized Analysis
  8. Tree Traversals (Preorder, Inorder, Postorder, BFS)
  9. Hash Table Operations (Linear Probing / Separate Chaining)
  10. Space Complexity Analysis (Iterative & Recursive)
  11. Recursion Analysis (Type, Tail Calls, Optimization)
  12. (2,4) Tree Operations (Insert / Delete / Overflow / Underflow)
  13. Red-Black Tree Operations & (2,4) Tree Correspondence
  14. Dijkstra's Algorithm Execution
  15. Linked List Operations (SLL / DLL / CLL)
  16. AVL Tree Operations (Insert / Delete / Rotations)
  17. Minimum Spanning Trees (Kruskal's / Prim's)
  18. Data Structure Choice for Application
  19. Priority Queue Implementations Comparison
  20. Non-Comparison Sorting (Bucket / Radix / Counting Sort)
  21. Formal Big-O / Big-Ω Proof
  22. Identify Data Structure from Code
  23. Stack / Queue Behavior Tracing
  24. Topological Ordering
  25. Graph Representation Comparison
  26. Iterator Behavior (Snapshot vs Lazy)
  27. Explain What Algorithm Does
  28. Merge Sort Execution & Recursion Tree
  29. Quicksort / Quickselect
  30. Positional List Operations (DLL with Sentinels)
  31. Time Complexity Polynomial for Iterative Method
  32. BST Properties & Operations
  33. Array-Based Tree Representation
  34. Deep Copy / Shallow Copy / Clone Behavior

1. Asymptotic Notation Concepts (Big-O / Ω / Θ) Very High

MID 2018 Q1-Q4 • 2019 Q1 • 2022 Q1-Q2 • 2024 Q1 • 2025 Q1  |  END 2020 Q1-Q2 • 2022 Q1 • 2023 Q1 • 2024 Q1 • 2025 Q1,Q3  |  RES 2019 Q1 • 2022 Q1 • 2023 Q1 • 2024 Q1 • 2025 Q1
Identify true/false statements about Big-O, Big-Ω, and Big-Θ relationships. Compare asymptotic growth rates, determine tightest bounds for piecewise or composite functions, and understand the formal definitions.

Methods to Solve

Example (MID 2018 Q1): What is the asymptotic relationship between (c · n log n) and nc for c=1? Since n1 = n and n log n grows faster than n, (n log n) is Ω(nc). Answer: A.

2. Sorting Algorithm Properties & Comparisons Very High

MID 2018 Q13-Q14 • 2019 Q17-Q18 • 2022 Q11-Q13 • 2024 Q11-Q14 • 2025 Q12-Q14  |  END 2020 Q13-Q16 • 2022 Q10-Q12 • 2023 Q7-Q9 • 2024 Q7-Q9 • 2025 Q7-Q8  |  RES 2019 Q9,Q11 • 2022 Q9-Q11 • 2023 Q7-Q9 • 2024 Q6-Q8 • 2025 Q7-Q9
Identify true/false statements about sorting algorithms: stability, in-place property, time/space complexity, comparison-based nature. Trace execution of sorting algorithms on given arrays.

Methods to Solve

Example (MID 2019 Q18): Selection sort CANNOT be implemented with a sorted list PQ (that would be insertion sort). Answer: A is false.

3. Closed Form Derivation by Repeated Unfolding Very High

MID 2018 Q22c • 2019 Q24c • 2022 Q16 • 2024 Q17 • 2025 Q17  |  END 2020 Q24b • 2022 Q21 • 2023 Q17 • 2024 Q17 • 2025 Q17  |  RES 2019 Q24b • 2022 Q22 • 2023 Q17 • 2024 Q17 • 2025 Q17
Given a recurrence equation (e.g., T(n) = c1 + 2·T(n/2)), derive the closed-form solution by repeatedly substituting the recurrence into itself, identifying a pattern, then expressing in terms of n.

Methods to Solve

Example (MID 2018 Q22c): T(1)=c0, T(n)=c1+2T(n/2). Unfolding k times: T(n) = (2k-1)c1 + 2kT(n/2k). Let k=log2n: T(n) = (n-1)c1 + nc0 = O(n).

4. Recurrence Relation Setup (Base & Recursive Case) Very High

MID 2018 Q22b • 2019 Q24b • 2022 Q15 • 2024 Q16 • 2025 Q16  |  END 2020 Q24a • 2023 Q16 • 2024 Q16 • 2025 Q16  |  RES 2019 Q24a • 2022 Q21 • 2023 Q16 • 2024 Q16 • 2025 Q16
Given a recursive Java method, derive the base case T(base) = c0 and the recurrence equation T(n) = ... + T(...) expressing worst-case time or space complexity. Define all variables and constants, and justify each term by referencing code lines.

Methods to Solve

Example (MID 2019 Q24b): methodY has a for loop (c2·n) and one recursive call on (n-1): T(0) = c0, T(n) = c1 + n·c2 + T(n-1).

5. Heap Operations & Heap Sort Very High

MID 2019 Q9-Q11 • 2022 Q9,Q14 • 2024 Q9-Q10,Q13 • 2025 Q11  |  END 2020 Q13 • 2022 Q8 • 2023 Q6 • 2024 Q5-Q6 • 2025 Q5  |  RES 2019 Q5 • 2022 Q8,Q10 • 2024 Q5 • 2025 Q4
Trace heapify (bottom-up construction), insert with up-heap bubbling, removeMin/removeMax with down-heap bubbling. Determine array state after k operations of in-place heap sort.

Methods to Solve

Example (MID 2019 Q10): Heapify [12,10,9,5,6,1] into min-heap: down-heap from index 2 (swap 9↔1), then index 1 (swap 10↔5), then index 0 (swap 12↔1, then 12↔9) ⇒ [1,5,9,10,6,12].

6. Array vs Linked List Complexity Comparison Very High

MID 2018 Q9 • 2019 Q7-Q8 • 2022 Q4 • 2024 Q6 • 2025 Q4  |  END 2020 Q4 • 2022 Q4 • 2024 Q3-Q4  |  RES 2022 Q3-Q4 • 2024 Q3 • 2025 Q3,Q5
Compare the worst-case time complexity of the same operation (remove middle, reverse, find element, extract subsequence) when implemented with an array vs a singly-linked list or doubly-linked list.

Methods to Solve

Example (MID 2019 Q7): Reverse a sequence using ADT operations only. Array: O(n) swap pairs. SLL (ADT only, no node access): O(n2) since next() is O(1) but finding elements requires traversal. Answer: B.

7. Dynamic Array Resizing & Amortized Analysis Very High

MID 2018 Q7-Q8 • 2019 Q6 • 2024 Q5 • 2025 Q6  |  END 2022 Q4 • 2023 Q4 • 2025 Q3  |  RES 2019 Q3 • 2022 Q5 • 2024 Q2,Q4
Determine amortized time complexity of operations on dynamic arrays with different resizing strategies (doubling, adding constant, geometric factor). Also applies to stack push/pop backed by dynamic arrays.

Methods to Solve

Example (MID 2018 Q7-Q8): methodZ resizes by f*s+1 (geometric, factor 2): calling n times is O(n) amortized. If changed to s+3 (arithmetic): calling n times is O(n2).

8. Tree Traversals (Preorder, Inorder, Postorder, BFS) Very High

MID 2019 Q20-Q22 • 2022 Q11 • 2024 Q8 • 2025 Q8-Q9  |  END 2020 Q12 • 2022 Q7,Q9 • 2023 Q5 • 2024 Q5 • 2025 Q6,Q13  |  RES 2023 Q5
Determine traversal order for a given tree (from array representation or linked nodes). Identify which traversal a code snippet implements. Reconstruct tree from traversal output. Compare traversal orders for special tree shapes.

Methods to Solve

Example (MID 2025 Q9): Code pushes root to stack, then recurses right, then left. Popping from stack reverses this: left subtree first, then right, then root = postorder.

9. Hash Table Operations (Linear Probing / Separate Chaining) Very High

END 2020 Q17-Q18 • 2022 Q13 • 2023 Q10-Q11 • 2024 Q10-Q11 • 2025 Q10  |  RES 2019 Q12 • 2022 Q13 • 2023 Q10-Q11 • 2024 Q11 • 2025 Q10
Trace insert/delete/search operations on hash tables using linear probing or separate chaining. Handle DEFUNCT markers, determine bucket contents after a sequence of operations, and analyze expected time complexity with different load factors.

Methods to Solve

Example (END 2020 Q18): Delete key 16 (mark DEFUNCT), insert 27 at h(27)=27 mod 11, insert 6 which probes past DEFUNCT. Track each step carefully.

10. Space Complexity Analysis (Iterative & Recursive) Very High

MID 2018 Q4,Q21d • 2019 Q3 • 2025 Q2-Q3  |  END 2020 Q24 • 2022 Q2,Q5 • 2023 Q2 • 2024 Q16 • 2025 Q2  |  RES 2019 Q2,Q24d • 2023 Q2 • 2024 Q16 • 2025 Q2
Determine the worst-case space complexity of a method, accounting for stack frames in recursion, array allocations, and whether arrays are passed by reference or value.

Methods to Solve

Example (MID 2025 Q2-Q3): methodW creates a new array of size n-1 at each recursive call (depth n). Without tail recursion: all frames active = O(n2). With tail recursion: only one frame at a time = O(n).

11. Recursion Analysis (Type, Tail Calls, Optimization) Very High

MID 2018 Q5 • 2019 Q3-Q4 • 2024 Q2 • 2025 Q2-Q3  |  END 2020 Q5-Q6 • 2022 Q2 • 2024 Q2 • 2025 Q2  |  RES 2019 Q2
Identify whether a recursive method uses linear or binary recursion, whether it contains tail calls, and what changes would enable tail recursion optimization. Compare recursive vs iterative implementations.

Methods to Solve

Example (MID 2018 Q5): Method f has "return f(n/2)" (tail call) and "return 1 + f(n-1)" (NOT tail). It uses linear recursion (one call per path) and contains at least one tail call. Answer: A.

12. (2,4) Tree Operations (Insert / Delete / Overflow / Underflow) High

END 2020 Q20 • 2023 Q14 • 2024 Q14 • 2025 Q12  |  RES 2019 Q16 • 2022 Q15 • 2023 Q12 • 2024 Q14 • 2025 Q12
Trace insertions and deletions in (2,4) trees. Count overflow splits (on insert) and underflow fusions/transfers (on delete). Determine the number of nodes of each type (2-node, 3-node, 4-node) after operations.

Methods to Solve

Example (END 2023 Q14): Deleting 10 from a (2,4) tree: replace with successor, then the leaf underflows, fusion cascades upward. Count remaining 2-nodes.

13. Red-Black Tree Operations & (2,4) Tree Correspondence High

END 2020 Q25 • 2022 Q16 • 2023 Q15 • 2024 Q15 • 2025 Q12  |  RES 2019 Q16 • 2022 Q15 • 2023 Q13 • 2024 Q15
Count red/black nodes after insertions or deletions in red-black trees. Convert between (2,4) trees and red-black trees. Understand the correspondence between overflow/underflow and recoloring/restructuring.

Methods to Solve

14. Dijkstra's Algorithm Execution High

END 2022 Q17 • 2023 Q13 • 2024 Q12 • 2025 Q14  |  RES 2019 Q18 • 2022 Q19 • 2023 Q14 • 2024 Q9 • 2025 Q14
Trace Dijkstra's algorithm on a weighted graph: track distance label updates, count relaxations, determine when vertices are finalized, and identify the order of extraction from the priority queue.

Methods to Solve

Example (RES 2019 Q18): Running Dijkstra from A, vertex F gets distinct non-infinite labels as shorter paths are discovered through different intermediate vertices.

15. Linked List Operations (SLL / DLL / CLL) High

MID 2018 Q15-Q16 • 2019 Q14-Q15 • 2022 Q5 • 2025 Q5  |  END 2022 Q3,Q6  |  RES 2022 Q3 • 2024 Q3
Trace through linked list code to determine what operation it performs (addFirst, removeLast, etc.). Understand circularly-linked list rotation, identify which data structures can/cannot be built with a given list type.

Methods to Solve

Example (MID 2018 Q16): CLL = {Birch, Cherry, Oak, Pine}, tail → Oak. After rotate: tail → Pine. After removeFirst: remove Birch. Result: {Cherry, Oak, Pine} with head pointing to Cherry.

16. AVL Tree Operations (Insert / Delete / Rotations) High

END 2020 Q19 • 2025 Q11  |  RES 2019 Q13-Q15,Q17 • 2022 Q14 • 2024 Q13
Trace AVL tree insertions and deletions. Count the number of tri-node restructurings (rotations) needed. Determine the height or maximum number of nodes for a given AVL tree depth.

Methods to Solve

17. Minimum Spanning Trees (Kruskal's / Prim's) High

END 2020 Q21 • 2022 Q18 • 2024 Q13 • 2025 Q15  |  RES 2019 Q19 • 2022 Q20 • 2023 Q15 • 2024 Q10
Trace Kruskal's or Prim's algorithm on a weighted graph. Count the number of distinct MSTs, identify which edges are included, and understand when the algorithm terminates.

Methods to Solve

18. Data Structure Choice for Application High

MID 2024 Q18 • 2025 Q18  |  END 2023 Q18 • 2024 Q18 • 2025 Q18  |  RES 2022 Q24 • 2024 Q18 • 2025 Q18
Given a specific application with its required operations, compare data structures (array, linked list, hash map, BST/AVL, heap) and determine which gives the best time complexity for the given use case.

Methods to Solve

Example (MID 2024 Q18): Sorted list with O(1) add-highest and O(n) remove-by-value. Array: O(1) add at end, O(n) remove (shift). Linked list: O(1) add at tail, O(n) remove (traverse). Both are O(n) for remove, so equivalent.

19. Priority Queue Implementations Comparison High

MID 2022 Q8 • 2024 Q9 • 2025 Q10,Q18  |  END 2020 Q9 • 2023 Q7  |  RES 2022 Q9 • 2023 Q18
Compare the time complexity of PQ operations (insert, removeMin, peek) across three implementations: unsorted list, sorted list, and binary heap. Determine which is best for specific operation patterns.

Methods to Solve

20. Non-Comparison Sorting (Bucket / Radix / Counting Sort) High

END 2020 Q14-Q15 • 2024 Q9  |  RES 2022 Q12 • 2023 Q9 • 2024 Q8 • 2025 Q9
Identify when non-comparison sorts are applicable and their time complexity. Understand bucket sort, counting sort (csort), and radix sort (LSD/MSD) and when each outperforms comparison-based sorts.

Methods to Solve

21. Formal Big-O / Big-Ω Proof High

MID 2018 Q23 • 2019 Q25 • 2022 Q17  |  END 2019 Q25 • 2022 Q19  |  RES 2019 Q25 • 2022 Q23
Formally prove that f(n) is O(g(n)) or Ω(g(n)) by stating the mathematical conditions (∃ c, n0) and finding concrete values of c and n0 that satisfy the inequality.

Methods to Solve

Example (MID 2018 Q23): Prove 3(n+1)3 is Ω(n2). Choose c=1, n0=1. For any positive n: 3(n+1)3 ≥ 3n3 ≥ n2 = c·n2. QED.

22. Identify Data Structure from Code High

MID 2018 Q6 • 2019 Q5 • 2022 Q3,Q10 • 2024 Q3  |  END 2020 Q3 • 2023 Q3
Given a partial Java implementation (instance variables, method bodies), determine which ADT or data structure the code represents (stack, queue, deque, BST, general tree with parent references, etc.).

Methods to Solve

23. Stack / Queue Behavior Tracing High

MID 2018 Q18 • 2019 Q12 • 2022 Q6  |  END 2020 Q8 • 2025 Q4  |  RES 2019 Q4
Trace through code that uses stacks and/or queues. Determine the order in which elements are retrieved after a series of push/pop/enqueue/dequeue operations.

Methods to Solve

Example (MID 2018 Q18): S={1,2,3} pushed to stack, Q={4,5,6} enqueued. Pop all from S: 3,2,1. Dequeue all from Q: 4,5,6. Answer: B.

24. Topological Ordering High

END 2020 Q22 • 2022 Q20a • 2023 Q12  |  RES 2019 Q20 • 2024 Q9 • 2025 Q15
Count the number of valid topological orderings for a DAG, determine if a given sequence is a valid topological ordering, or identify which ordering is NOT valid.

Methods to Solve

25. Graph Representation Comparison High

END 2020 Q23c • 2022 Q20b-c • 2023 Q18 • 2025 Q18  |  RES 2019 Q22 • 2025 Q11
Compare edge list, adjacency list, adjacency matrix, and adjacency map representations for specific graph operations (iterate vertices, check edge existence, iterate neighbors).

Methods to Solve

26. Iterator Behavior (Snapshot vs Lazy) High

MID 2018 Q19-Q20 • 2019 Q19 • 2024 Q7 • 2025 Q7  |  RES 2022 Q6
Predict the output of code using snapshot vs lazy iterators. Understand that snapshot iterators copy the collection at creation time while lazy iterators reflect ongoing changes.

Methods to Solve

Example (MID 2018 Q19-Q20): printElements1 creates a new iterator each loop iteration ⇒ always prints first element: {10,10,10}. printElements2 reuses one iterator ⇒ prints consecutive: {10,50,100}.

27. Explain What Algorithm Does High

MID 2018 Q21a,Q22a • 2019 Q23c,Q24a • 2025 Q16  |  END 2022 Q20a
Given a Java method, describe in plain English what it computes, for which inputs it returns true, and sometimes suggest a more efficient alternative algorithm.

Methods to Solve

Example (MID 2019 Q23c): methodX returns true iff the difference between every pair of elements is at most 1. Faster: find min and max in O(n) and check if max - min ≤ 1.

28. Merge Sort Execution & Recursion Tree High

MID 2019 Q16 • 2024 Q12,Q15 • 2025 Q15  |  END 2025 Q9
Trace the merge sort recursion tree: determine subsequences at each level, array state after merging at a specific level, or after k iterations of bottom-up merge sort.

Methods to Solve

Example (MID 2025 Q15): Bottom-up merge sort on [2,13,6,24,43,1,51,9,10]. After iteration 1 (pairs): [(2,13),(6,24),(1,43),(9,51),(10)]. After iteration 2 (quads): [(2,6,13,24),(1,9,43,51),(10)].

29. Quicksort / Quickselect High

END 2022 Q11 • 2023 Q8 • 2024 Q8  |  RES 2019 Q10 • 2023 Q8
Trace in-place quicksort partition steps, count swaps and comparisons, understand worst-case recurrence. Compare quicksort and quickselect (1 vs 2 recursive calls).

Methods to Solve

30. Positional List Operations (DLL with Sentinels) High

MID 2018 Q17 • 2022 Q7 • 2024 Q4 • 2025 Q5  |  RES 2022 Q4
Count the number of prev/next reference accesses needed for positional list operations (addBefore, removeFirst, replace). Understand the Position abstraction and sentinel (header/trailer) nodes.

Methods to Solve

31. Time Complexity Polynomial for Iterative Method Low

MID 2018 Q21b • 2019 Q23a  |  END 2020 Q23a  |  RES 2019 Q23a
Write the exact polynomial T(n) = c0 + c1n + c2n2 for the worst-case time complexity of an iterative method. Define all constants and map each term to specific lines of code.

Methods to Solve

32. BST Properties & Operations Low

END 2023 Q5 • 2024 Q12 • 2025 Q6  |  RES 2024 Q12
Identify valid BST inorder traversals, determine properties that can be derived from a BST (inorder = sorted), and understand BST structure constraints.

Methods to Solve

33. Array-Based Tree Representation Low

MID 2019 Q20-Q21 • 2025 Q8  |  END 2020 Q11
Navigate array-based binary trees using index formulas. Determine which tree shapes use the most/least space, and perform traversals on array-represented trees.

Methods to Solve

34. Deep Copy / Shallow Copy / Clone Behavior Low

MID 2018 Q10-Q12  |  END 2020 Q10
Trace through code that copies arrays of objects using different clone methods. Determine whether modifications to the original affect the copy (shallow vs deep), and count the number of new objects created.

Methods to Solve

Example (MID 2018 Q10): copy() uses clone1() for even indices (deep copy) and clone2() for odd indices (reference copy). After changing rankA[0].value=40, rankB[0] still shows 25 (deep copied). rankA[1].value=15, rankB[1] shows 15 (shared reference).

Generated from 16 exams: Midterms 2018, 2019, 2022, 2024, 2025 | Endterms 2019, 2020, 2022, 2023, 2024, 2025 | Resits 2019, 2022, 2023, 2024, 2025
CSE1305 Algorithms & Data Structures, TU Delft