mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-04 00:27:47 +00:00
QuickSort: Don't sort a single item, nothing to do
This commit is contained in:
parent
eeab2e8bb5
commit
23a5ce3319
Notes:
sideshowbarker
2024-07-19 13:56:45 +09:00
Author: https://github.com/rburchell
Commit: 23a5ce3319
Pull-request: https://github.com/SerenityOS/serenity/pull/97
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue