Skip to content

Add heap sort algorithm

Yun.Long requested to merge feature/heap-sort into main

Closes #28

变更内容

  • sort.py: 新增 heap_sort() 函数,实现堆排序算法
  • test_sort.py: 注册 heap_sort 到测试列表,添加算法元数据
  • main.py: 添加 Heap Sort 演示
  • README.md: 更新算法表格,添加 Heap Sort 行

技术细节

堆排序是一种高效的比较排序算法:

  • 时间复杂度: O(n log n) (所有情况)
  • 空间复杂度: O(1) (原地排序)
  • 不稳定排序

测试结果

50 tests passed (包括 heap_sort 的所有测试用例)

关联 Issue

Closes #28

Merge request reports