We revisit the problem of permuting an array of length n according to a given permutation in place, that is, using only a small number of bits of extra storage. Fich, Munro and Poblete [FOCS 1990, SICOMP 1995 obtained an elegant O(n log n)-time algorithm using only O(log 2 n) bits of extra space for this basic problem by designing a procedure that scans the permutation and outputs exactly one element from each of its cycles. However, in the strict sense in place should be understood as using only an asymptotically optimal O(log n) bits of extra space, or storing a constant number of indices. The problem of permuting in this version is, in fact, a well-known interview question, with the expected solution being a quadratic-time algorithm. Surprisingly, no faster algorithm seems to be known in the literature.Our first contribution is a strictly in-place generalisation of the method of Fich et al. that works in Oε(n 1+ε ) time, for any ε > 0. Then, we build on this generalisation to obtain a strictly in-place algorithm for inverting a given permutation on n elements working in the same complexity. This is a significant improvement on a recent result of Guśpiel [arXiv 2019], who designed an O(n 1.5 )-time algorithm.
We revisit the Heaviest Induced Ancestors (HIA) problem that was introduced by Gagie, Gawrychowski, and Nekrich [CCCG 2013] and has a number of applications in string algorithms. Let T 1 and T 2 be two rooted trees whose nodes have weights that are increasing in all root-to-leaf paths, and labels on the leaves, such that no two leaves of a tree have the same label. A pair of nodes (u, v) ∈ T 1 × T 2 is induced if and only if there is a label shared by leaf-descendants of u and v. In an HIA query, given nodes x ∈ T 1 and y ∈ T 2 , the goal is to find an induced pair of nodes (u, v) of the maximum total weight such that u is an ancestor of x and v is an ancestor of y.Let n be the upper bound on the sizes of the two trees. It is known that no data structure of size Õ(n) can answer HIA queries in o(log n/ log log n) time [Charalampopoulos, Gawrychowski, Pokorski; ICALP 2020]. 1 This (unconditional) lower bound is a polyloglog n factor away from the query time of the fastest Õ(n)-size data structure known to date for the HIA problem [Abedin, Hooshmand, Ganguly, Thankachan; Algorithmica 2022]. In this work, we resolve the query-time complexity of the HIA problem for the near-linear space regime by presenting a data structure that can be built in Õ(n) time and answers HIA queries in O(log n/ log log n) time. As a direct corollary, we obtain an Õ(n)-size data structure that maintains the LCS of a static string and a dynamic string, both of length at most n, in time optimal for this space regime.The main ingredients of our approach are fractional cascading and the utilization of an O(log n/ log log n)-depth tree decomposition. The latter allows us to break through the Ω(log n) barrier faced by previous works, due to the depth of the considered heavy-path decompositions.
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.
customersupport@researchsolutions.com
10624 S. Eastern Ave., Ste. A-614
Henderson, NV 89052, USA
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Copyright © 2024 scite LLC. All rights reserved.
Made with 💙 for researchers
Part of the Research Solutions Family.