문제

I want to sort integers and I know radix sort is supposed to be awesome for it. Any library implementation for this sort?

도움이 되었습니까?

해결책

Depends on how strictly you define radix sort, since Boost 1.58.0 includes Spreadsort, which is a hybrid sorting algorithm that heuristically mixes bucket and comparison sorting.

For sorting integers and with no requirement for worst-case Θ(n) efficiency, Spreadsort should satisfy you.

For argument's sake, you can also take a look at my implementation of LSD radix sort, which is fairly inefficient with memory but occasionally faster than Spreadsort. You only require the radix_sort branch but I've linked to the speed_test branch because it has the readme.

다른 팁

The more actual answer is Yes since 1.58 it does:

It has something known as SpreadSort and will "magically" detect optimized paths for types like std::string, or floating point numbers that can be treated as byte arrays.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top