< Linked queue AutoProof Code Repository Map ADT >

Longest Common Prefix (LCP)

Category: Algorithm

Source: FM'12


The longest common prefix problem is defined as follows. Given an integer array a, and two indices x and y into this array, return the length of the longest common prefix of the subarrays of a starting at x and y respectively.

download source