LIPIcs.SEA.2024.28.pdf
- Filesize: 0.64 MB
- 14 pages
In this work we introduce the problem of finding a minimum cost acceptable element in an n × n matrix M whose columns and rows are sorted in non-decreasing order. More precisely, given a sorted matrix M and access to a given oracle function f: ℕ × ℕ → {True, False}, one has to find a pair (i, j) of indices such that f(i,j) returns True and the value M[i,j] is as small as possible. Assuming the computation of f(i,j) takes time bounded by a constant, a naive algorithm scanning all the positions of the matrix takes time O(n²). Another natural approach, based on a priority queue, takes time O(z log z) in which z stands for the position of the first pair of indices for which the oracle returns True in a sorted list of all elements of M. In the worst case, when z = n², the naive algorithm is better than the priority queue one. In this work we introduce different algorithms with complexities depending on n and z, such as O(n √z) and O(min(n²,z²)), and compare them, both theoretically and experimentally, in terms of running time and number of calls to the oracle. Among other things, we find that in most cases our algorithms do not make a significantly larger number of calls to the oracle than the priority queue-based algorithm, which achieves the minimum of such call when all elements of the matrix are distinct, while being much faster in large instances.
Feedback for Dagstuhl Publishing