浏览代码

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)
 {
     int size = end - start;
-    if (size <= 0)
+    if (size <= 1)
         return;
 
     int pivot_point = size / 2;