64
11

A Work-Efficient Parallel Algorithm for Longest Increasing Subsequence

Abstract

This paper studies parallel algorithms for the longest increasing subsequence (LIS) problem. Let nn be the input size and kk be the LIS length of the input. Sequentially, LIS is a simple textbook problem that can be solved using dynamic programming (DP) in O(nlogn)O(n\log n) work. However, parallelizing LIS is a long-standing challenge. We are unaware of any parallel LIS algorithm that has optimal O(nlogn)O(n\log n) work and non-trivial parallelism (i.e., O~(k)\tilde{O}(k) or o(n)o(n) span). Here, the work of a parallel algorithm is the total number of operations, and the span is the longest dependent instructions. This paper proposes a parallel LIS algorithm that costs O(nlogk)O(n\log k) work, O~(k)\tilde{O}(k) span, and O(n)O(n) space, and is \emph{much simpler} than the previous parallel LIS algorithms. We also generalize the algorithm to a weighted version of LIS, which maximizes the weighted sum for all objects in an increasing subsequence. Our weighted LIS algorithm has O(nlog2n)O(n\log^2 n) work and O~(k)\tilde{O}(k) span. We also implemented our parallel LIS algorithms. Due to simplicity, our implementation is light-weighted, efficient, and scalable. On input size 10910^9, our LIS algorithm outperforms a highly-optimized sequential algorithm (with O(nlogk)O(n\log k) cost) on inputs with k3×105k\le 3\times 10^5. Our algorithm is also much faster than the best existing parallel implementation by Shen et al. on all input instances.

View on arXiv
Comments on this paper