From 6e4765b2ac6b5e5cb9d4941e7e6e7da22fba506d Mon Sep 17 00:00:00 2001 From: beppeb Date: Mon, 20 Oct 2025 13:34:24 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20quicksort.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- quicksort.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quicksort.py b/quicksort.py index f026b94..e1edabd 100644 --- a/quicksort.py +++ b/quicksort.py @@ -1,6 +1,6 @@ def quick_sort(arr): if len(arr) <= 1: - return arr # 递归终止条件:数组长度为1或为空 + return arr pivot = arr[len(arr) // 2] # 选取中间元素作为基准 left = [x for x in arr if x < pivot] middle = [x for x in arr if x == pivot]