Skip to content

feat: Add Quick Sort Algorithm Implementation

Yun.Long requested to merge wip/add-quicksort-algorithm into main

概述

为python-sort-algorithm项目添加快速排序算法实现。

更改内容

  • sort.py 中实现了 quick_sort 函数
  • 添加了完整的测试覆盖和算法元数据
  • 更新了 README.md 中的算法复杂度表格
  • 在 main.py 演示中包含了快速排序
  • 遵循项目约定进行算法实现

算法特性

  • 时间复杂度: 平均 O(n log n),最坏 O(n²)
  • 空间复杂度: O(log n)
  • 稳定性: 非稳定排序
  • 实现方式: 使用最后一个元素作为基准的分区策略

测试结果

所有现有测试通过,新增的快速排序算法通过所有测试用例。

更改统计

 README.md    | 13 +++++++------
 main.py      |  3 ++-
 sort.py      | 32 ++++++++++++++++++++++++++++++++
 test_sort.py | 12 ++++++++++--
 4 files changed, 51 insertions(+), 9 deletions(-)

Closes #13 (closed)

Merge request reports