Cheapest cooking

Authors

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

Abstract

The article from the series dedicated to problems of Mathematical Olympiad – category P (programming) discusses different solutions of one theoretical competition problem from the regional round of the 2017/18 school year. The task is to find the cheapest way to cook food with the help of a list of instructions. The input prices of the individual ingredients are given and we can use the food prepared according to the individual recipes as input for other follow-up recipes. Algorithms solving this problem are analogous to known graph algorithms for shortest distances in evaluated graph: Bellman-Ford and Dijkstra algorithms. The article also presents a brief outline of these two graph algorithms. Besides the detailed analysis of the problem, we find in the article three basic variants of the solution with different time complexity. Two of these solutions are written in the form of a sample program.

Published

2020-01-29

How to Cite

Töpfer, P. (2020). Cheapest cooking. MATHEMATICS–PHYSICS–INFORMATICS, 29(1), 69–77. Retrieved from https://mfi.upol.cz/index.php/mfi/article/view/487

Issue

Section

Informatics