Effective implementation of algorithms (Master Thesis)
Effective and error-free implementation of algorithms
|
#include <manber_myers.h>
Static Private Member Functions | |
template<typename _Iterator > | |
static void | sortByFirstCharacter (_Iterator first, _Iterator last, int sigma, std::vector< int > *out) |
Constructs suffix array in O(n log n) time with Mamber-Myers algorithm.
The implementation is optimized to use as little memory as possible without great increase in code complexity, in this case it is 3N ints and 2N bools of storage. Note that authors of the paper claims it can be done in 2N ints, but I haven't been able to fully comprehend and write bug-free code for that version. Note: another implementation and some discussion can be found at http://forums.topcoder.com/?module=RevisionHistory&messageID=1171511
static void strings::suffix_array::ManberMyers::sortByFirstCharacter | ( | _Iterator | first, |
_Iterator | last, | ||
int | sigma, | ||
std::vector< int > * | out | ||
) | [inline, static, private] |
Sort suffixes by first character. Note: This implementation is count-sort, because for reasonable small alphabets quicksort is awfully slow.