# Changeset 1844:eaa5f5b855f7 in lemon-0.x for lemon

Ignore:
Timestamp:
12/03/05 19:15:43 (14 years ago)
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2403
Message:

Changed implementation and bug fix

File:
1 edited

Unmodified
Added
Removed
• ## lemon/radix_sort.h

 r1833 template unsigned char valueByte(Value value, int byte) { return *((unsigned char *)(&value) + byte); return value >> (std::numeric_limits::digits * byte); } bool dir = true; std::copy(first, last, buffer); for (int i = 0; i < sizeof(Value); ++i) { for (int i = 0; i < (int)sizeof(Value); ++i) { if (dir) { counterIntroSort(buffer, buffer + length, buffer + length, i, functor); counterIntroSort(buffer, buffer + length, buffer + length, i, functor); } else { counterIntroSort(buffer + length, buffer + 2 * length, buffer, i, functor); counterIntroSort(buffer + length, buffer + 2 * length, buffer, i, functor); } dir = !dir; /// in the right order in \c O(n) time. The algorithm sorts the container /// by each bytes in forward direction which sorts the container by the /// whole value. This way, let be /// \c c the maximal capacity and \c n the number of the items in /// whole value. This way, let be \c c the maximal capacity of the integer /// type and \c n the number of the items in /// the container, the time complexity of the algorithm \c O(log(c)*n) /// and the additional space complexity is \c O(n).
Note: See TracChangeset for help on using the changeset viewer.