COMPSCI320 Applied Algorithmics
COMPSCI320 Overview
- University of Auckland
- Semester 2 2026
- Level 3 computer science
- 15-point course
- Paper exam, Exam Mode C
What COMPSCI320 teaches
Applied Algorithmics is the University of Auckland's course on the design and analysis of algorithms.
- Assessed by Six programming assignments, a midterm test and a final exam on paper.
- Must pass Both the practical component and the written component, not just the total.
- Hardest habit Proving correctness and a tight running time, not only giving an algorithm.
- How to revise Practise each technique alone, then mix problems so choosing the technique is part of the task.
What you get in the full COMPSCI320 Exam Bible
- 13 chapters, 66 pages — every examinable topic, week by week
- 34 original practice questions, each with a model answer in the Final exam format
- 13 worked examples, solved the way COMPSCI320 marks
- 25 computed figures, redrawn from the course’s own numbers
- Exam-morning plan for the Final exam (50%) — what to revise last, where marks are lost
Free on this page: assessment table, chapter map, one worked example, key terms, FAQ. The rest is in the full exam bible.
How COMPSCI320 is assessed
| Component | Weight | Format |
|---|---|---|
| Programming assignments (six) | 30% | Automarked programs, one per design technique; part of the practical component |
| Midterm test | 20% | 16 September 2026; closed book, no electronic devices; part of the written component |
| Final exam | 50% | Exam Mode C: in-person invigilated exam on paper, 30 October 2026; part of the written component |
Weights come from the Semester 2 2026 assessment overview and total 100%. To pass, students need at least 50% of the total marks and a pass in both the practical component (the assignments) and the written component (the test plus the exam). The printed header of the 2026 midterm question paper states 10%, while the answer version of the same paper, the assessment overview, the schedule and the course home page give 20%. Confirm permitted exam materials on your exam timetable in SSO.
Assessment structure
What other students are asking about COMPSCI320
- Where can I find lecture notes or study guides for COMPSCI320 at auckland?
- The COMPSCI320 study guide in AskSia Library covers Applied Algorithmics in 13 chapters, with the assessment table, a chapter-by-chapter topic map, key terms and a worked example, free to read on this page.
- Is there a final exam in COMPSCI320, and how much is it worth?
- Yes. In the offering this AskSia Library guide is built from, Final exam carries 50% of the COMPSCI320 mark; the full split is Programming assignments (six) 30%, Midterm test 20%, Final exam 50%.
- What does COMPSCI320 cover on graph traversal, shortest paths and spanning trees?
- In AskSia Library's COMPSCI320 guide, the Graph Traversal, Shortest Paths and Spanning Trees chapter explains breadth-first and depth-first trees, Dijkstra traces with decrease events, topological order and minimum spanning trees.
- What does COMPSCI320 cover on stable matching and the gale-shapley algorithm?
- In AskSia Library's COMPSCI320 guide, the Stable Matching and the Gale-Shapley Algorithm chapter explains preference lists, blocking pairs, the hospital-proposing algorithm, termination and proofs by contradiction.
- What does COMPSCI320 cover on greedy algorithms and exchange arguments?
- In AskSia Library's COMPSCI320 guide, the Greedy Algorithms and Exchange Arguments chapter explains earliest finish time, greedy stays ahead, exchange proofs for file ordering and counterexamples to greedy rules.
Current COMPSCI320 dates
| Date | Item | Control |
|---|---|---|
| 30 October 2026 | Final exam (Exam Mode C, on paper) | Canvas lists the exam on Friday 30 October 2026 at 9am; the room appears on your SSO exam timetable from 5pm the evening before. |
Dates are as published in the Semester 2 2026 Canvas course summary and exam page. Confirm exact deadlines and submission settings in the live LMS.
What COMPSCI320 covers
The course moves from asymptotic analysis and a review of graph algorithms through stable matching, greedy algorithms, divide and conquer and dynamic programming to network flow and NP-completeness. The chapter order follows the published teaching schedule, so each technique arrives after the analysis tools it relies on.
Asymptotic Analysis and Algorithm Efficiency
Big-O, Big-Omega and Big-Theta definitions, constant witnesses, tightest bounds and the Perrin number case studyThis chapter sets up the vocabulary used for every running time in the course.
- Big-O as an upper bound with constants c and n0
- Big-Omega and Big-Theta
- Proving a tight polynomial bound
- Counterexamples to transformed bounds
- Growth rates of n log n, n squared and 2 to the n
- The Perrin numbers and three algorithms
Graph Traversal, Shortest Paths and Spanning Trees
Breadth-first and depth-first trees, Dijkstra traces with decrease events, topological order and minimum spanning treesThe first module reviews the graph algorithms from the prerequisite course and asks you to run them by hand.
- Breadth-first levels and depth-first ancestors
- Dijkstra's permanent order and relaxations
- Recovering the shortest-path tree
- Single-vertex levels as separators
- Kahn's topological sort and cycle detection
- Minimum spanning trees with Kruskal and Prim
Stable Matching and the Gale-Shapley Algorithm
Preference lists, blocking pairs, the hospital-proposing algorithm, termination and proofs by contradictionStable matching introduces the full design cycle on one problem: state it precisely, give an algorithm, prove termination and correctness, and bound its work.
- Perfect matchings and preference lists
- Blocking pairs and stability
- Proposals, holds and rejections
- Termination after at most n squared proposals
- Proof by an exhibited blocking pair
Greedy Algorithms and Exchange Arguments
Earliest finish time, greedy stays ahead, exchange proofs for file ordering and counterexamples to greedy rulesGreedy algorithms take one irrevocable choice at a time, and the course judges them by their proofs.
- Interval scheduling by earliest finish time
- The greedy stays ahead induction
- Exchange arguments with adjacent swaps
- Building a counterexample to a greedy rule
- Coin change and knapsack traps
- Interval problems in the second assignment
Greedy Graph Colouring and Interval Partitioning
Smallest free colour, the maximum degree plus one bound, vertex order, interval graphs and clique lower boundsThis chapter studies greedy colouring from the fourth tutorial. Each vertex receives the smallest colour not used by a coloured neighbour, which never needs more than the maximum degree plus one colours.
- Proper colourings and the chromatic number
- The smallest free colour rule
- The maximum degree plus one bound
- Why the vertex order matters
- Interval graphs coloured by start time
- Cliques as lower bounds
Divide and Conquer Recurrences and Inversions
Writing recurrences, recursion trees, the Master theorem as taught, induction proofs and sort and count inversionsDivide and conquer was the largest midterm topic, so this chapter covers its analysis carefully.
- Writing a recurrence from pseudocode
- Recursion trees and level costs
- The three cases of the Master theorem
- Induction proofs for halving recurrences
- Counting inversions while merging
- Binary search on sorted and rotated arrays
Fast Multiplication and the Fast Fourier Transform
Karatsuba's three products, Strassen's seven block products, even and odd splitting and evaluation at roots of unityGrade-school multiplication of n-digit numbers costs quadratic time, and this chapter shows how divide and conquer beats it.
- Why the four-product split gains nothing
- The Karatsuba identity
- Strassen's seven block products
- Polynomial multiplication in value form
- Even and odd splitting at roots of unity
- Convolution and its applications
Dynamic Programming Foundations
State definitions, transitions and base cases, path independent sets, rising subsequences and weighted schedulingDynamic programming stores the answers to overlapping subproblems so each is solved once.
- State, transition and base cases
- Memoised recursion and bottom-up tables
- Independent sets on a path
- Longest rising subsequence
- Maximum subarray and sub-matrix sums
- Weighted interval scheduling
Sequence Alignment, Edit Distance and Linear Space
Gap and mismatch penalties, the alignment recurrence, table filling and traceback, Hirschberg and common subsequencesEdit distance measures how similar two strings are by the cheapest alignment under a gap penalty and a mismatch penalty.
- Alignments without crossing pairs
- Gap and mismatch penalties
- The three-case recurrence
- Filling and tracing back the table
- Hirschberg's linear-space method
- Longest common subsequence
Shortest Paths with Negative Weights
Why Dijkstra fails, the edge-budget recurrence, Bellman-Ford-Moore passes, negative cycle detection and arbitrageNegative edge lengths break Dijkstra's greedy rule, and adding a constant to every edge does not repair it.
- Why Dijkstra fails on negative edges
- Shortest paths with at most i edges
- The table version and its cost
- Bellman-Ford-Moore with early stopping
- Detecting negative cycles
- Arbitrage and distance-vector routing
Maximum Flow and Minimum Cut
Flow networks and cuts, residual graphs, augmenting paths, Ford-Fulkerson and the max-flow min-cut theoremNetwork flow begins with a directed graph, a source, a sink and capacities.
- Capacity and conservation constraints
- Cuts and their capacities
- Residual graphs and backward edges
- Augmenting paths and bottlenecks
- The max-flow min-cut theorem
- Integrality and running time
Faster Flow Algorithms and Flow Modelling
Capacity scaling, shortest augmenting paths, Dinitz and unit capacities, and assignment models with vertex limitsThis chapter fixes the running time of Ford-Fulkerson and turns flow into a modelling tool.
- Capacity scaling and its phases
- Shortest augmenting paths and level graphs
- Dinitz's algorithm and unit capacities
- Assignment problems as layered networks
- Vertex splitting for throughput limits
- Feasibility from the flow value
NP-Completeness and Polynomial-Time Reductions
Reduction direction, certificates and certifiers, independent set and vertex cover, 3-SAT gadgets and the reduction treeThe last module asks what to do when no efficient algorithm is likely.
- Polynomial-time reductions and their direction
- Certificates and certifiers
- P, NP, NP-hard and NP-complete
- Independent set, vertex cover and clique
- The 3-SAT to independent set gadget
- Colouring, subset sum and knapsack reductions
Its prescription covers fundamental design techniques for efficient problem solving, methods that are provably correct and efficient, the efficiency analysis that decides which algorithm suits a job, and the limits of computation through NP-completeness.
The learning outcomes ask students to define a computational problem precisely, design an algorithm with a named technique, estimate its big-Theta running time, choose the most promising technique for a new problem, and map a hard problem onto an NP-hard one with a formal reduction.
How the semester is organised
The Semester 2 2026 schedule runs in two-week blocks.
Weeks 1 and 2 introduce algorithm analysis and review graph algorithms from the prerequisite course, with stable matching and a case study on Perrin numbers. Weeks 3 and 4 cover greedy algorithms, Weeks 5 and 6 divide and conquer, Weeks 7 and 8 dynamic programming, Weeks 9 and 10 network flow, and Weeks 11 and 12 NP-completeness.
Six programming assignments run alongside, one per technique, submitted to an automated marker.
What the assessment asks for
The assignments carry 30%, the midterm test 20% and the final exam 50%. The final is an in-person invigilated exam on paper. To pass, a student needs at least half of the total marks and a pass in both the practical and the written components.
The 2026 midterm shows the written style: definitions with explicit constants, an algorithm trace, counterexamples to greedy rules, and recurrence work with an induction proof.
How to use this guide
Each chapter opens with a computed figure and the definitions you need, works one original example in full, and ends with practice questions whose model answers show the structure a marker expects.
Rebuild every example without looking, then change one feature of the instance and decide whether the technique still works.
Worked example · free
Trace Dijkstra and read off the shortest-path tree
- 1Make s permanent at 0; label a = 6 and b = 2.
- 1Make b permanent at 2; lower a to 5 and label c = 9 and t = 11.
- 1Make a permanent at 5; lower c to 6.
- 1Make c permanent at 6; lower t to 8, then make t permanent.
- 1Follow predecessors from t: s, b, a, c, t with length 2 + 3 + 1 + 2 = 8.
Key terms
- Algorithmics
- The study of how algorithms are designed and how their correctness and efficiency are analysed.
- Big-Theta Bound
- A statement that a running time is bounded above and below by constant multiples of the same function.
- Greedy Algorithm
- An algorithm that builds a solution through a sequence of locally best, irrevocable choices.
- Exchange Argument
- A proof that rearranges any optimal solution into the greedy one without making it worse.
- Divide and Conquer
- A design technique that splits a problem into smaller instances, solves them recursively and combines the answers.
- Master Theorem
- A rule giving the Theta class of a recurrence of the form aT(n/b) plus a power of n.
- Dynamic Programming
- A design technique that stores the answers of overlapping subproblems so each is solved once.
- Edit Distance
- The cheapest total penalty of an alignment between two strings.
- Negative Cycle
- A directed cycle whose edge lengths add to less than zero.
- Residual Graph
- A graph of the spare and cancellable capacity left by a flow.
- Minimum Cut
- A source-sink split of the vertices with the smallest total capacity of edges leaving the source side.
- Polynomial-Time Reduction
- A transformation that solves one problem using polynomially many steps and calls to a solver for another.
- NP-Complete Problem
- A problem in NP to which every problem in NP reduces in polynomial time.
- Certificate
- A short piece of evidence that a certifier can check to confirm a yes answer.
COMPSCI320 FAQ
How is the course assessed?
The Semester 2 2026 assessment overview gives six programming assignments 30% in total, the midterm test 20% and the final exam 50%. The briefs for Assignments 2 to 6 each state 5% of the course marks. Assignments are submitted to an automated marker, while the test and the exam are written papers. Check Canvas for any update to dates or instructions.
What format does the final exam take?
Canvas lists it as Exam Mode C, an in-person invigilated exam on paper, on Friday 30 October 2026 at 9am. Your exam room appears on your exam timetable in SSO from 5pm the evening before, and the same timetable lists any permitted materials. Electronic devices and watches are not allowed, and you need your Campus Card.
What kinds of questions did the midterm test use?
The 2026 midterm was a 60-minute written paper of four questions worth 40 marks. It asked for a formal definition and a proof with explicit constants, a tightest bound, a full Dijkstra trace, two counterexamples to greedy rules, and a divide and conquer recurrence with the Master theorem and an induction proof. Answers were expected to show all working.
Do I need to pass a particular part of the course?
Yes. Besides at least half of the total marks, the course home page requires a pass in both the practical component, which is the assignments, and the written component, which is the test and the exam together. A strong assignment record cannot by itself make up for a weak written performance, so prepare for the exam as a separate requirement.
Which programming languages can I use for the assignments?
The syllabus asks students to program efficiently in one of Python, C++, Rust, Java, Go or C#, and the first assignment brief says the automated marker accepts most common languages on Linux, reading standard input and writing standard output. Some briefs set their own rules, so the third assignment, for example, required Python; always read each brief.
How do I decide which design technique fits a problem?
Look for structural signals. A natural order with a safe local choice suggests greedy; independent halves suggest divide and conquer; overlapping subproblems indexed by a small number suggest dynamic programming; supplies, limits and pairings suggest network flow; and resemblance to satisfiability, colouring or covering suggests an NP-hardness proof. The learning outcomes ask you to make exactly this choice.
What does a complete NP-completeness proof contain?
Two parts. First show the problem is in NP by giving a certificate and a polynomial-time certifier. Then choose a known NP-complete problem and reduce it to the new one: give a polynomial construction and prove that a yes instance maps to a yes instance and that a yes answer comes back. Reversing the direction is the classic mistake.
Questions students ask in each COMPSCI320 chapter
- Why does a proof of Big-O need the constants written out?
- Big-O is defined by the existence of a constant multiplier and a threshold beyond which the inequality holds. Naming them, for example c = 17 and n0 = 1, turns the claim into something a marker can check line by line. A sentence saying the leading term dominates states the intuition but proves nothing about the definition. Chapter 01 · Asymptotic Analysis and Algorithm Efficiency
- Why can Dijkstra not revisit a permanent vertex?
- It makes a vertex permanent only when its tentative distance is the smallest among unfinished vertices. With non-negative edge weights, any other route must pass through a vertex whose distance is already at least as large, so it cannot be shorter. That argument fails once negative edges are allowed, which is why a different algorithm is needed for them. Chapter 02 · Graph Traversal, Shortest Paths and Spanning Trees
- Is a matching stable if one person would like to switch?
- Yes, it can still be stable. Stability only fails when two people would both rather be matched to each other. If a hospital prefers another student but that student prefers her current partner, the pair does not block, so the matching survives. The definition protects mutual preference, not the happiness of every individual. Chapter 03 · Stable Matching and the Gale-Shapley Algorithm
- What must a greedy counterexample contain to earn full marks?
- It needs a specific instance, the solution the greedy rule actually produces on it with its value, and a strictly better feasible solution with its value. A sentence saying the rule can fail earns nothing. Small instances work best because the marker can verify each solution at a glance, and one line explaining why greedy missed the better answer completes it. Chapter 04 · Greedy Algorithms and Exchange Arguments
- Why can greedy colouring never need more than maximum degree plus one colours?
- When a vertex is coloured, at most d of its neighbours already have colours, where d is the maximum degree. So at most d colours are blocked, and one of the colours from 1 to d + 1 is always free. The rule therefore never reaches colour d + 2, whatever order the vertices are visited in. Chapter 05 · Greedy Graph Colouring and Interval Partitioning
- Which constants must I state when applying the Master theorem?
- Name a, the number of recursive calls, b, the factor by which the input shrinks, and c, the exponent of the combining work. Then compute the logarithm of a to base b, say which of the three cases holds and give the Theta class. Mergesort, with a = 2, b = 2 and c = 1, falls in the middle case and gives n log n. Chapter 06 · Divide and Conquer Recurrences and Inversions
- Why does saving one multiplication change the exponent?
- The number of recursive calls sets the number of leaves in the recursion tree. Four half-size calls give four to the power log n leaves, which is n squared. Three calls give three to the power log n, which is n to about 1.585. The extra additions cost only linear time per level and cannot outweigh the smaller leaf count. Chapter 07 · Fast Multiplication and the Fast Fourier Transform
- What should come first in a dynamic programming answer?
- The state definition, written in words. Say exactly what one entry means, for example the best weight using the first i vertices, and check that the original problem is one of the entries. The transition, base cases and running time all follow from that sentence, and a wrong or vague state is the most common reason a recurrence fails. Chapter 08 · Dynamic Programming Foundations
- Why are the first row and column of the table not zero?
- They align a prefix of one string with the empty string, so every character of that prefix is left unmatched and pays the gap penalty. The entry for a prefix of length i is therefore i times the gap penalty. Writing zeros there is the most common slip on these tables and shifts every later entry. Chapter 09 · Sequence Alignment, Edit Distance and Linear Space
- Why does adding a constant to every edge not fix Dijkstra?
- Adding the same amount to each edge penalises a path once per edge, so paths with many edges grow more than paths with few. The shortest path can therefore change after the shift. The lecture shows a small graph where the true shortest route uses three edges but becomes longer than a one-edge route once every length is increased. Chapter 10 · Shortest Paths with Negative Weights
- Why does a cut's capacity ignore edges pointing back to the source side?
- Capacity measures the most flow that could leave the source side, so only edges from the source side to the sink side count. Flow on edges coming back is subtracted when computing the net flow across the cut, but it never adds capacity. Counting those edges is a frequent slip and makes a cut look larger than it is. Chapter 11 · Maximum Flow and Minimum Cut
- How many phases does capacity scaling use?
- The threshold starts at the largest power of two not exceeding the largest capacity C and halves until it reaches 1, so there are one plus the floor of log base two of C phases. The lecture shows each phase uses at most 2m augmentations, giving a total running time of m squared times log C. Chapter 12 · Faster Flow Algorithms and Flow Modelling
- Which way should a hardness reduction go?
- From the known hard problem to the new one. To show a new problem Y is hard, take an arbitrary instance of a known NP-complete problem X and build an instance of Y with the same answer, proving X ≤p Y. Reducing Y to X only shows Y is no harder than X, which says nothing about its difficulty. Chapter 13 · NP-Completeness and Polynomial-Time Reductions
How to study for the exam
Revise in three passes. In the first, make each technique fluent on its own: write the definitions with their constants, trace Dijkstra, Gale-Shapley, Ford-Fulkerson and Bellman-Ford on new instances, solve recurrences with the Master theorem, and fill dynamic programming tables with their tracebacks.
In the second, rehearse the proofs: stays ahead, exchange, clique lower bounds, induction on recurrences, the max-flow min-cut certificate and two-direction reductions, each written with labelled steps. In the third, mix problems so that choosing the technique becomes part of the question, which is what the learning outcomes demand.
Time yourself at the midterm pace of one and a half minutes per mark, and end every design answer with a running time. Keep the integrity rules of the course in mind: this guide is for study and revision, not for completing assessed work.
Your AI Computer Science tutor for COMPSCI320
Stuck on a hard COMPSCI320 question? Sia is AskSia’s AI Computer Science tutor — ask any COMPSCI320 Applied Algorithmics question and get a clear, step-by-step explanation grounded in how the course is actually taught and assessed. Read this whole study guide free, then take your hardest questions to Sia.