FR version is available. Content is displayed in original English for accuracy.
Advertisement
Advertisement
⚡ Community Insights
Discussion Sentiment
50% Positive
Analyzed from 376 words in the discussion.
Trending Topics
#https#parentheses#gpu#bit#com#same#tree#query#level#per

Discussion (7 Comments)Read Original on HackerNews
You can solve the same problem with Range Min Max Tree. The query for balanced or unbalanced parentheses is O(log N). If you use a bit vector to represent the parentheses (1 for open paren, 0 for close paren) and apply succinct data structure on the bit vector, you can use RMMTree + succinct_bit_vector to speed things up. A two or three level RMMTree can represent billions of parentheses already (two levels of 65536 branch factor = 4B bits or 4B parentheses). The query is O(65536 + 65536) or effectively O(1). For a four-level tree of 256 branch factor, the query is O(256 + 256 + 256 + 256) or O(1). It becomes a problem of memory access vs number of entries to process per level.
Since the bits can be constructed from the parentheses by segments, it can be broken up into multiple bit vectors, one per segment, and be processed in parallel. Multiple RMMTrees can be used, one per bit segment, and the trees can be processed in parallel.
Earlier versions of the work were featured on HN [3][4], but this is much more sophisticated. (plus a few more zero-comment submissions)
The basic idea (bicyclic semigroup and binary search) is the same as the submission. I think earliest attribution is to Bar-On and Vishkin[5] from 1985. Another implementation of this idea is in pareas[6], an experimental GPU-accelerated compiler.
I believe this work is publishable and would love to work with a student to resubmit it. Especially if you're a student or prof in Sydney, please reach out.
[1]: https://arxiv.org/abs/2205.11659
[2]: https://github.com/raphlinus/raphlinus.github.io/issues/66
[3]: https://news.ycombinator.com/item?id=24385095
[4]: https://news.ycombinator.com/item?id=27164009
[5]: https://dl.acm.org/doi/10.1145/3318.3478
[6]: https://github.com/Snektron/pareas
https://okmij.org/ftp/