Преглед на файлове

QuickSort: Don't sort a single item, nothing to do

Robin Burchell преди 6 години
родител
ревизия
23a5ce3319
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      AK/QuickSort.h

+ 1 - 1
AK/QuickSort.h

@@ -12,7 +12,7 @@ template <typename Iterator, typename LessThan>
 void quick_sort(Iterator start, Iterator end, LessThan less_than = is_less_than)
 void quick_sort(Iterator start, Iterator end, LessThan less_than = is_less_than)
 {
 {
     int size = end - start;
     int size = end - start;
-    if (size <= 0)
+    if (size <= 1)
         return;
         return;
 
 
     int pivot_point = size / 2;
     int pivot_point = size / 2;