Finding the Optimal Solution

Authors

  • Pavel Töpfer Faculty of Mathematics and Physics, Charles University, Prague

Abstract

The article continues an earlier introduction to dynamic programming and focuses on its use in optimisation problems. The basic idea is to solve progressively smaller instances of a problem, store their results, and determine the optimal value by taking the minimum or maximum of previously computed values. The first problem analysed in detail is that of finding the longest path between two vertices in a topologically ordered directed acyclic graph. An inefficient enumeration of all possible paths is compared with a dynamic-programming solution, and the reconstruction of the optimal path itself using predecessor information is also demonstrated. The second example concerns an optimisation problem involving a sequence of tasks. Two equivalent dynamic-programming formulations are presented together with an analysis of their time and space complexity.

Published

2026-08-30

How to Cite

Töpfer, P. (2026). Finding the Optimal Solution. MATHEMATICS–PHYSICS–INFORMATICS, 35(03), 226–233. Retrieved from https://mfi.upol.cz/index.php/mfi/article/view/1144

Issue

Section

Informatics