Longest segment of balanced parentheses – an exercise in program inversion in a segment problem (Functional Pearl)

01/24/2021
by   Shin-Cheng Mu, et al.
0

Given a string of parentheses, the task is to find a longest consecutive segment that is properly bracketed. We find it an interesting problem because it involves two techniques: the usual approach for solving segment problems, and the converse-of-a-function theorem – through which we derived an instance of shift-reduce parsing.

READ FULL TEXT

Please sign up or login with your details

Forgot password? Click here to reset

Sign in with Google

×

Use your Google Account to sign in to DeepAI

×

Consider DeepAI Pro