lemon/radix_sort.h
changeset 2015 5e51c9eb5e83
parent 1956 a055123339d5
child 2033 7bf1f64962c2
equal deleted inserted replaced
4:d7519f626cb9 5:2552ca2d06bd
   262   template <typename Functor, typename Key>
   262   template <typename Functor, typename Key>
   263   void counterIntroSort(Key *first, Key *last, Key *target, 
   263   void counterIntroSort(Key *first, Key *last, Key *target, 
   264 		       int byte, Functor functor) {
   264 		       int byte, Functor functor) {
   265     const int size = 
   265     const int size = 
   266       (unsigned int)std::numeric_limits<unsigned char>::max() + 1;
   266       (unsigned int)std::numeric_limits<unsigned char>::max() + 1;
   267     int counter[size];
   267     std::vector<int> counter(size);
   268     for (int i = 0; i < size; ++i) {
   268     for (int i = 0; i < size; ++i) {
   269       counter[i] = 0;
   269       counter[i] = 0;
   270     }
   270     }
   271     Key *it = first;
   271     Key *it = first;
   272     while (first != last) {
   272     while (first != last) {
   288   template <typename Functor, typename Key>
   288   template <typename Functor, typename Key>
   289   void signedCounterIntroSort(Key *first, Key *last, Key *target, 
   289   void signedCounterIntroSort(Key *first, Key *last, Key *target, 
   290 			     int byte, Functor functor) {
   290 			     int byte, Functor functor) {
   291     const int size = 
   291     const int size = 
   292       (unsigned int)std::numeric_limits<unsigned char>::max() + 1;
   292       (unsigned int)std::numeric_limits<unsigned char>::max() + 1;
   293     int counter[size];
   293     std::vector<int> counter(size);
   294     for (int i = 0; i < size; ++i) {
   294     for (int i = 0; i < size; ++i) {
   295       counter[i] = 0;
   295       counter[i] = 0;
   296     }
   296     }
   297     Key *it = first;
   297     Key *it = first;
   298     while (first != last) {
   298     while (first != last) {