New answers tagged


If a node has $l$ children, with $l \geq 2$ during the inorder visit you have to treat the first $l-1$ children as left nodes, and you have to visit the parent multiple ($l-1$) times, writing multiple times the length of the prefix spelled inside the lcp array. This, applied to the tree in the image, would yield the correct: SA = [7, 6, 4, 2, 1, 5, 3] lcp = [...

Top 50 recent answers are included