1

I'm trying to implement block sorting. This is from the Burrows Wheeler paper.

(Before this step, you create a V suffix array of S)

Q4. [radix sort]
Sort the elements of V , using the first two characters of each suffix as the sort key. This can be done efficiently using radix sort.

So I understand you are sorting the suffixes with radix sort.
How is this supposed to update the array V? Only after the radix sort finished I can know the sorted position of a suffix. Suppose that the 4th suffix end up being the first after sorted. So V[0] = i. In this case, we know (because I told you) that i = 4. But how does the algorithm know that since we are not keeping track of their position. Should I make a Class that contains both the suffix and its suffix number?

Guido Tarsia
  • 1,962
  • 4
  • 27
  • 45

1 Answers1

2

After a quick read; I think Burrows-Wheeler have an error and meant to say to sort the elements of W using the array V to track and map the final locations of the elements of W. ie. Such that W is unchanged and V contains a sorted list of indices.

The paper appears to treat V as an array of pointers to elements in W from that point forward.

Check out http://michael.dipperstein.com/bwt/ There is a great description as well as source code for the algorithm at the bottom of the page.

Toaster
  • 1,911
  • 2
  • 23
  • 43
  • I don't think so, you actually have to sort the suffixes. Maybe he meant that you actually sort both V and W (V for sure). This paper is so ambiguous and uncomplete it makes me want to bomb the authors houses. – Guido Tarsia Jun 15 '11 at 04:13
  • OK, maybe. I took it to mean to sort W using W[i]'s suffix as the key for each row i - and store the results in V. – Toaster Jun 15 '11 at 04:17
  • Ha, yes, incompleteness is unfortunately common in academic papers. – Toaster Jun 15 '11 at 04:19
  • Check out the line... The new value of W[V[i]] sorts into the same position as the old value, but has the desirable property that it is distinct from all other values in W... this seems to be the critical point on what is expected of V and W. – Toaster Jun 15 '11 at 04:22
  • Here you go. Have you checked out this site http://michael.dipperstein.com/bwt/ ? He also has a link to an implementation so you can read the code. – Toaster Jun 15 '11 at 04:26