GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Python/sorts/recursive_quick_sort.py at master · https-github-com-nzysoft/Python Expand file tree/ Copy pathrecursive_quick_sort.pyMore file actions 22 lines (19 loc) · 486 Bytes / Copy pathrecursive_quick_sort.pyFile metadata and controls22 lines (19 loc) · 486 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 def quick_sort(data: list) -> list: """ >>> for data in ([2, 1, 0], [2.2, 1.1, 0], "quick_sort"): ... quick_sort(data) == sorted(data) True True True """ if len(data) <= 1: return data else: return ( quick_sort([e for e in data[1:] if e <= data[0]]) + [data[0]] + quick_sort([e for e in data[1:] if e > data[0]]) ) if __name__ == "__main__": import doctest doctest.testmod() |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |