References & Citations
Computer Science > Programming Languages
Title: Longest segment of balanced parentheses -- an exercise in program inversion in a segment problem (Functional Pearl)
(Submitted on 24 Jan 2021 (v1), last revised 21 Aug 2021 (this version, v2))
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.
Submission history
From: Shin-Cheng Mu [view email][v1] Sun, 24 Jan 2021 12:20:27 GMT (50kb,D)
[v2] Sat, 21 Aug 2021 09:57:50 GMT (17kb,D)
Link back to: arXiv, form interface, contact.