Rectangular Ruler Wrapping

10/04/2022
by   Xing Lyu, et al.
0

In 1985 Hopcroft, Joseph and Whitesides introduced the problem of folding a carpenter's ruler with n hinged segments of lengths ℓ_1, …, ℓ_n into an interval of a given length k. By folding we mean that each hinge must be either straight or folded 180 degrees, with folded hinges alternating between being folded clockwise and counterclockwise. They showed this problem is NP-hard in the weak sense by a reduction from Partition, gave a pseudo-polynomial-time algorithm for it, and gave an O (n)-time 2-approximation algorithm. Gagie, Saeidi and Sapucaia recently considered the related problem of wrapping the ruler into the interval instead of folding it. By wrapping we mean that all the folded hinges must be folded 180 degrees clockwise. They gave an O (n)-time algorithm for this problem, based on the O (n log n)-time algorithm for Longest Increasing Subsequence that Fredman analyzed and attributed to Knuth, thus answering a question posed by O'Rourke during the open-problems session of CCCG '21. Hopcroft et al. and Gagie et al. assume the ruler's segments are lines and its hinges are points, so a folded ruler has length but zero width. As anyone who has ever folded something knows, however, making perfect 180-degree folds is not always possible. In this paper we initiate the study of rectangular ruler wrapping, for which all folded hinges are to be folded 90 degrees clockwise instead of 180 degrees and we want the wrapped ruler to fit in a rectangle of height h and width w. We give a quartic algorithm and then an O (n^2 polylog (n))-time algorithm.

READ FULL TEXT

Please sign up or login with your details

Forgot password? Click here to reset