Why complexity analysis needs both proof and measurement
Algorithmic complexity analysis describes how the resources an algorithm needs, usually time and memory, grow as the input grows. The standard tools are asymptotic bounds in a stated model of computation: the worst-case bound over all inputs of size n, and the average-case bound under a stated probability distribution over inputs (Cormen et al., 2022). These bounds are mathematical results. They are proved, not observed, and they deliberately ignore constant factors and lower-order terms.
That is their strength and their limit. A worst-case bound guarantees behaviour on every input, but it can be very pessimistic. The simplex method for linear programming is the classic case: exponential in the worst case, yet fast on the problems people actually solve. Spielman and Teng (2004) introduced smoothed analysis to explain this, measuring the worst case of the expected running time when inputs are slightly perturbed at random. For a doctoral methodology the lesson is simple: say which kind of analysis you are doing, under which model and which input assumptions, before you say anything about efficiency.
Measurement answers different questions: how large the constants are, where the asymptotic regime begins, how the algorithm interacts with caches and parallel hardware, and whether it beats the alternatives on realistic inputs. Most computer science PhDs that propose an algorithm need both kinds of evidence, and the methodology chapter has to explain how they fit together.
How researchers in Germany have approached the problem
German computer science has a well-developed tradition here, usually called algorithm engineering, centred on groups at Karlsruhe, Munich, Berlin and elsewhere. Reading a few of its key studies is the quickest way to see what examiners in this tradition expect.
A method, not just a set of results
Sanders (2009), at Karlsruhe, defined algorithm engineering as a general methodology for algorithmic research: a cycle of design, analysis, implementation and experimental evaluation that he compared with Popper's scientific method, supported by realistic machine models, algorithm libraries and benchmarks built from real-world instances. Theory and experiment are treated as complementary, and falsified hypotheses from experiments feed back into new designs. Mendling et al. (2026), a team based mainly in Berlin, Karlsruhe and Hamburg, have since set out a fuller research framework for the field. They distinguish the real-world problem, the algorithmic task, the algorithm design and its implementation, and name the validity threats that each kind of contribution must address, including design, implementation, external and construct validity.
When practice outruns the bound
Route planning shows why the cycle matters. Geisberger et al. (2008), also at Karlsruhe, introduced contraction hierarchies, which preprocess a road network by contracting nodes in order of importance and adding shortcut edges, then answer queries with a bidirectional search. They reported query times five times lower than the best previous hierarchical Dijkstra-based techniques and a distance structure smaller than the original graph. The evidence for this was experimental, on real road networks, rather than a worst-case bound: on arbitrary graphs the method offers no comparable guarantee. A thesis in this style must therefore be explicit about the class of inputs to which its claims apply.
Comparing fairly
Axtmann et al. (2022) at KIT engineered in-place parallel sorting algorithms with a provably cache-efficient blockwise data distribution. Because the sorting literature contained conflicting performance claims, they evaluated 21 state-of-the-art sorting codes on 6 data types, 10 input distributions, 4 machines and 4 memory allocation strategies, with input sizes spanning 7 orders of magnitude, and found that many competitors performed worse than their own published benchmarks suggested. The scale of that design is unusual, but the principle is not: claims of superiority must survive inputs and machines the author did not choose to flatter the method.
At LMU Munich, Kriegel et al. (2017) asked whether runtime experiments in data mining compare algorithms or implementations. Testing clustering and outlier detection methods with and without index acceleration, they found large runtime differences between implementations of the same algorithm, enough to swamp the differences between algorithms that papers report. They concluded that the design of fair and conclusive runtime experiments will always remain a challenge, and recommended comparing methods within one framework and one level of implementation effort.
Measuring correctly
Beyer et al. (2019), also at LMU Munich, examined measurement itself. They showed that common timing approaches miss the CPU time of child processes, that sampling misses short memory peaks, and that hardware sharing changes results: in their experiments, running on hyperthreaded sibling cores increased CPU time by about 53%, and a shared L3 cache had effects of roughly 22% to 39% depending on Turbo Boost. Their solution, the open-source BenchExec framework, uses Linux control groups and namespaces to measure and limit resources and to isolate runs from one another.
| Study (institution) | What they studied | Problem reported | How they handled it |
|---|---|---|---|
| Sanders, 2009 (Karlsruhe) | Definition of algorithm engineering | Gap between theory and practical performance | Design, analyse, implement, experiment as one cycle |
| Geisberger et al., 2008 (Karlsruhe) | Route planning on road networks | Speed not explained by a worst-case bound | Experimental evidence on real networks, claims limited to that input class |
| Axtmann et al., 2022 (KIT) | In-place parallel sorting | Conflicting performance claims in the literature | Large factorial benchmark over codes, data, machines and sizes |
| Kriegel et al., 2017 (LMU Munich) | Clustering and outlier detection runtimes | Implementation quality confounds comparisons | Compare within one framework; report implementation details |
| Beyer et al., 2019 (LMU Munich) | Benchmarking of software tools | Mismeasured CPU time and memory; hardware interference | Control groups, isolation and full reporting (BenchExec) |
Designing your methodology
The German studies suggest a structure that works for most algorithmic theses. Begin with the task, not the algorithm: define the input, the output, the cost measure that matters to users (time, memory, I/O, energy, communication) and the model of computation in which you will analyse it, such as the RAM model, an external-memory model or a parallel model. The textbook by Sanders et al. (2019) is a useful German reference that treats sequential and parallel models side by side.
- State the analytical claim. Give the worst-case or average-case bound you will prove for time and space, with the model and, for average-case claims, the input distribution.
- Turn the claim into testable hypotheses. For example, that runtime grows no faster than n log n on the chosen inputs, or that the method is faster than a named baseline beyond a stated input size.
- Choose instances deliberately. Combine real-world benchmark instances, synthetic families that vary one property at a time, and adversarial inputs close to your worst case. Say why each set is there.
- Choose baselines fairly. Use the strongest available competitors, in their authors' best implementations where possible, or reimplement all methods in one framework (Kriegel et al., 2017).
- Plan the measurement before you collect data, including repetitions, warm-up runs, timers and resource limits (Beyer et al., 2019; McGeoch, 2012).
- Plan the analysis, including how you will summarise repeated runs and estimate scaling.
A worked example: checking a bound against measurements
The figures below are hypothetical and purely illustrative. Suppose you have proved an O(n log n) worst-case time bound for a new sorting-based method and measured the median of ten timed runs, after warm-up, at five input sizes on one machine.
| Input size n | Median time (ms) | Time / (n log2 n) (ns) |
|---|---|---|
| 216 (65,536) | 2.2 | 2.10 |
| 218 (262,144) | 10.1 | 2.14 |
| 220 (1,048,576) | 46.2 | 2.21 |
| 222 (4,194,304) | 217.0 | 2.35 |
| 224 (16,777,216) | 1,023.1 | 2.54 |
Two checks are useful. First, divide each time by the bound's growth function. If the bound describes the behaviour, the ratio should level off; here it rises slowly, from 2.10 to 2.54 nanoseconds. Second, fit a straight line to log time against log n: the slope here is about 1.11, slightly above the value of about 1 expected for n log n over this range. Neither check proves anything about the asymptotic bound. Together they suggest that, on this machine, a second effect grows with input size, most plausibly the data outgrowing the caches. The honest write-up reports the proved bound, the measured scaling and the likely explanation, and tests that explanation, for example by measuring cache misses or repeating the experiment on a machine with a different cache size (McGeoch, 2012).
Published papers show both halves of this habit. Veličković et al. (2018) state the time complexity of one graph attention head as O(|V|FF' + |E|F'), where |V| and |E| are the numbers of nodes and edges and F and F' the input and output feature dimensions, and compare it with existing graph convolutional networks. Krizhevsky et al. (2012), by contrast, give no asymptotic analysis but do report the hardware and cost that matter for reproduction: the network was split across two GPUs with 3 GB of memory each and took five to six days to train. A strong thesis gives readers both kinds of information.
Measuring runtime and memory reliably
Measurement is where most avoidable errors happen. The following practices follow from the studies above and from the experimental algorithmics literature (McGeoch, 2012; Beyer et al., 2019).
- Distinguish CPU time from wall-clock time, and make sure the CPU time of any child processes or threads is counted.
- Measure peak memory with a method that cannot miss short peaks, such as kernel-level accounting, rather than periodic sampling.
- Fix and report the hardware state: processor model, core pinning, whether hyperthreading and frequency boosting were enabled, memory size and NUMA layout.
- Repeat runs, discard or report warm-up runs, and summarise with medians and an interval or spread, not a single number.
- Report compiler, compiler flags, library versions and the operating system, and record random seeds for randomised algorithms or input generators.
- Run all competitors on the same machine under the same limits, within one framework where possible (Kriegel et al., 2017).
Working within German research rules
Doctoral research in Germany is governed by the doctoral regulations (Promotionsordnung) of your faculty and by your university's rules on good research practice, which implement the code of the Deutsche Forschungsgemeinschaft (Deutsche Forschungsgemeinschaft, 2019). Several of its guidelines translate directly into methodological requirements for algorithmic work.
- Quality assurance (guideline 7). Each step is carried out lege artis, and published results explain the quality assurance used, the origin of data and the software used, in a citable form.
- Documentation (guideline 12). Record everything needed to understand and check a result, including runs that did not support your hypothesis. A versioned experiment log and scripts that regenerate every table meet this requirement in practice.
- Public access (guideline 13). Results are made available together with the data, methods and software behind them. For research software you wrote yourself, the code expects the source code to be published where this is possible and reasonable.
- Archiving (guideline 17). Research data underlying published results are generally kept for ten years, so archive your benchmark instances, raw timing data and the exact code version.
Most doctoral regulations also ask you to declare that you wrote the dissertation yourself and to name the aids you used. Check yours early, especially if you plan a cumulative dissertation built from published papers, where co-authored experimental work needs a clear statement of your own contribution.
What to report in the methodology chapter
| Element | What to state |
|---|---|
| Task and cost measure | Input, output, the resource measured and why it matters |
| Model of computation | RAM, external-memory, parallel or other, with its assumptions |
| Analytical results | Worst-case or average-case bounds, with the input distribution for average case |
| Instances | Real, synthetic and adversarial sets, with sources and generation parameters |
| Baselines | Competitors, their versions, and how implementation effort was equalised |
| Environment | Hardware, operating system, compiler and flags, libraries, hardware settings |
| Measurement | Timers, memory method, repetitions, warm-up, resource limits, tooling |
| Analysis | Summary statistics, scaling estimates and how they relate to the bounds |
| Availability | Repository and archive for code, instances and raw results |
Common mistakes
- Calling an experiment a "worst-case test" without showing that the inputs are close to the analytical worst case.
- Claiming a complexity class from a runtime plot over one or two orders of magnitude.
- Comparing your carefully optimised code with a competitor's unoptimised or differently implemented code.
- Reporting the best of several runs, or a single run, without saying so.
- Leaving hardware settings, compiler flags and library versions out of the chapter.
- Citing a famous paper for a claim it does not make, for example citing an applied deep learning paper as evidence about complexity theory.
A good final test is to ask whether another doctoral researcher, given your repository and chapter, could rerun your experiments and reach the same conclusions about how your measurements relate to your bounds.
Key takeaways
- State which analysis you are doing, worst-case, average-case or smoothed, in which model and under which assumptions (Cormen et al., 2022; Spielman & Teng, 2004).
- German algorithm engineering treats design, analysis, implementation and experiment as one cycle (Sanders, 2009; Mendling et al., 2026).
- Limit performance claims to the input classes and machines you tested (Geisberger et al., 2008; Axtmann et al., 2022).
- Control implementation quality when comparing algorithms (Kriegel et al., 2017).
- Design and report the measurement method itself, including hardware settings (Beyer et al., 2019).
- Document, publish and archive code, instances and raw data as the DFG code expects (Deutsche Forschungsgemeinschaft, 2019).
