Skip to content

feat: 实现希尔排序算法 (Shell Sort)

Yun.Long requested to merge feature/872-python-sort-algorithm into main

变更内容

为项目新增希尔排序(Shell Sort)算法实现,关联需求 product/agentichub/requirements#872。

修改文件

  • sort.py: 新增 shell_sort 函数,采用 Ciura 经验间隔序列(701, 301, 132, 57, 23, 10, 4, 1)
  • test_sort.py: 注册 shell_sortSORT_FUNCTIONS 列表,补充 ALGO_INFO 元数据
  • main.py: 在演示循环中加入 Shell Sort
  • README.md: 更新算法对比表格,新增 Shell Sort 一行

算法特性

项目
时间复杂度(平均) O(n log² n)
时间复杂度(最坏) O(n²)
空间复杂度 O(1)
稳定性 不稳定

设计亮点

使用 Ciura (2001) 经验间隔序列,这是目前已知实践效果最优的 Shell Sort 间隔序列,在各种输入规模下均有出色表现。

测试结果

全部 60 个测试用例通过

Closes product/agentichub/requirements#872

Merge request reports