bwtTernaryRadixSort
private fn
void bwtTernaryRadixSort(uint[] indices, const(ubyte)[] block,
uint lo, uint hi, int depth, uint[] temp) pure nothrowTernary radix quicksort for BWT indices.
This is a three-way partitioning radix sort that partitions elements into three groups based on a pivot byte: less than, equal to, and greater than. It's more efficient than counting sort for medium-sized arrays because it avoids the O(256) overhead of initializing count arrays.
The algorithm:
- Select pivot byte (median of three at current depth)
- Partition into <pivot, =pivot, >pivot regions
- Recursively sort < and > regions at same depth
- Recursively sort = region at depth+1
Parameters
indices | Array of indices to sort. |
block | The data block. |
lo | Start of range (inclusive). |
hi | End of range (exclusive). |
depth | Current byte depth. |
temp | Temporary buffer (unused here, for API compatibility). |