Longest segment of balanced parentheses -- an exercise in program inversion in a segment problem (Functional Pearl)
Shin-Cheng Mu, Tsung-Ju Chiang

TL;DR
This paper presents a linear-time solution for finding the longest balanced parentheses segment, combining segment problem techniques with function inversion and shift-reduce parsing methods.
Contribution
It introduces a novel approach that integrates segment problem strategies with function inversion and shift-reduce parsing for balanced parentheses.
Findings
Linear-time algorithm for longest balanced segment
Innovative use of function inversion in segment problems
Application of shift-reduce parsing techniques
Abstract
Given a string of parentheses, the task is to find the longest consecutive segment that is balanced, in linear time. We find this problem interesting because it involves a combination of techniques: the usual approach for solving segment problems, and a theorem for constructing the inverse of a function -- through which we derive an instance of shift-reduce parsing.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsAlgorithms and Data Compression · semigroups and automata theory · Logic, programming, and type systems
