Skip to content

Add Quick Sort algorithm

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

Closes #17 (closed)

Add Quick Sort algorithm with median-of-three optimization

Changes

  • Implemented Quick Sort algorithm in sort.py
  • Added median-of-three pivot selection to improve performance on sorted/reverse sorted arrays
  • Registered algorithm in test suite with full metadata
  • Updated README documentation
  • Added to demo program

Testing

All 50 tests pass including:

  • Correctness tests on various input patterns
  • Input immutability verification
  • Performance test on 1000-element reversed array

Complexity

  • Time: O(n log n) average, O(n²) worst case
  • Space: O(log n) due to recursion stack
  • Stable: No

Merge request reports