kcjkldjs dskl jfdkl

 

how to add some code fragment

 

template<class T>
 void ListSorterQuick<T>::sortR(int first, int last, int depth)
 {
     // base case -- stack overflow
  
     if (depth > 3500)
         throw std::overflow_error("Failed qsort--stack too deep");
     try {
     // base case -- empty list
     if (first > last)
         return;
         int pivotIndex = partition(first, last);
         sortR(first, pivotIndex - 1, depth + 1);
         sortR(pivotIndex + 1, last, depth + 1);
     }
     catch (std::overflow_error& e)
     {
         std::cout << e.what() << std::endl;
     }
      
 }

Comments

Post a comment