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

page 1

page 2

page 3

page 4

research
04/07/2020

Zipping Segment Trees

Stabbing queries in sets of intervals are usually answered using segment...
research
07/08/2020

String Indexing for Top-k Close Consecutive Occurrences

The classic string indexing problem is to preprocess a string S into a c...
research
10/26/2017

Segment Parameter Labelling in MCMC Mean-Shift Change Detection

This work addresses the problem of segmentation in time series data with...
research
07/14/2018

A Simple and Space Efficient Segment Tree Implementation

The segment tree is an extremely versatile data structure. In this paper...
research
01/21/2022

Approximating the discrete and continuous median line segments in d dimensions

Consider a set P of n points in ℝ^d. In the discrete median line segment...
research
02/13/2023

Encoding Sentence Position in Context-Aware Neural Machine Translation with Concatenation

Context-aware translation can be achieved by processing a concatenation ...

Please sign up or login with your details

Forgot password? Click here to reset