Questions or need anything? Email codingcirculate@gmail.com or DM on Instagram @walicontext

Computer Science

CS502 Past Papers

Fundamentals of Algorithms

CS502 current papers · Fall 2026

Questions students remember from this semester's exams

Midterm

3 PDFs

CS502 Midterm Spring 2013

  • Solved paper · by Masoom Fairy
Preview & download

CS502 Midterm Compiled

  • Solved subjective · by Moaaz Siddiq
  • Solved MCQs · by Moaaz Siddiq
Preview & download

Final Term

2 PDFs

  • Solved MCQs · by Moaaz Siddiq
  • Solved subjective · by Moaaz Siddiq
Preview & download

CS502 handouts

1 published handout for this course

Preview & download

About CS502

Fundamentals of Algorithms, course code CS502, is the Virtual University course on designing algorithms and proving how fast they run. The official synopsis describes a mainly theoretical course that does not require programming but does expect familiarity with mathematical proof and elementary discrete mathematics. It emphasises the worst-case running time of an algorithm as a function of input size, and it also explores the boundary between feasible, polynomial-time computation and infeasible computation. The official course calendar starts with a model of computation and uses the two-dimensional maxima problem, including a sweep-line algorithm, to introduce runtime analysis. Asymptotic notation follows, applied to merge sort and its analysis, then solving recurrence relations and median selection with a partitioning algorithm. Sorting is studied in depth: binary heaps and heap sort, quick sort and its analysis, lower bounds for comparison sorting, and linear-time methods such as counting sort, bucket sort and radix sort. Dynamic programming is introduced with the Fibonacci sequence and worked through edit distance, chain matrix multiplication and the 0/1 knapsack problem. Greedy algorithms follow with the coin-change problem and Huffman encoding; the calendar places the midterm after the first Huffman lecture, and Huffman encoding continues straight after it. The second half covers activity scheduling and the fractional knapsack, then graphs: definitions, representations, breadth-first and depth-first search, generic traversal, cycles, topological sorting, strong components, minimum spanning trees with Kruskal's and Prim's algorithms, and shortest paths with Dijkstra's, Bellman-Ford and Floyd-Warshall. The course closes with complexity theory: the classes P and NP, reductions, graph colouring, Boolean satisfiability and independent sets. According to the official learning outcomes, a learner should be able to analyse running time, solve recurrences, and apply divide and conquer, dynamic programming, greedy and graph techniques. Solved CS502 past papers are listed here as they are added.

View all 21 Computer Science courses