-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
Description
The current quick sort algorithm is too concrete. It's better to make it more generic. The points that I listed here:
-
Make
partitioncan be rewrite and we provide an implementation for it. This means we should makepartitionas an interface and provide a default implementation. -
Make
quick_sortAPI can be passed any iterable type. In another word, The API should looks like:
void quick_sort(std::random_iterator<?> begin, std::random_iterator<?> end);- Provide another overloading API for
quick_sortwhich can be passed a comparer:
using Comparable = std::function<bool (const random_iterator<?> &prev, const random_iterator<?> &next)>;
void quick_sort(std::random_iterator<?> begin, std::random_iterator<?> end, Comparable comparer);TODOs:
- implementation
- benchmark
- ut
- docs
Reactions are currently unavailable