Python/sorts
Tan Kai Qun, Jeremy 12431389e3
Add typing to topological_sort.py (#9650)
* Add typing

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Jeremy Tan <jeremytan@stripe.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-03 21:47:03 -04:00
..
__init__.py Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +02:00
bead_sort.py refactor: Indent ... for visual purposes (#7744) 2022-10-27 19:42:30 +02:00
binary_insertion_sort.py Working binary insertion sort in Python (#8024) 2023-05-11 06:50:32 +12:00
bitonic_sort.py Remove useless code in doctests (#7733) 2022-10-27 22:52:00 +02:00
bogo_sort.py Update bogo_sort.py (#8144) 2023-02-20 11:14:01 +13:00
bubble_sort.py Update sorts/bubble_sort.py (#5802) 2023-07-31 11:50:00 -07:00
bucket_sort.py Fix sorts/bucket_sort.py implementation (#5786) 2023-08-17 18:38:19 -07:00
circle_sort.py Make some ruff fixes (#8154) 2023-03-01 17:23:33 +01:00
cocktail_shaker_sort.py [mypy]Correction of all errors in the sorts directory (#4224) 2021-02-23 10:02:30 +01:00
comb_sort.py pre-commit: Upgrade psf/black for stable style 2023 (#8110) 2023-02-01 18:44:54 +05:30
counting_sort.py [pre-commit.ci] pre-commit autoupdate (#9013) 2023-08-29 15:18:10 +02:00
cycle_sort.py [pre-commit.ci] pre-commit autoupdate (#9013) 2023-08-29 15:18:10 +02:00
double_sort.py [pre-commit.ci] pre-commit autoupdate (#9013) 2023-08-29 15:18:10 +02:00
dutch_national_flag_sort.py Add more ruff rules (#8767) 2023-05-26 09:34:17 +02:00
exchange_sort.py Create exchange_sort.py (#4600) 2021-08-15 07:43:05 +02:00
external_sort.py Replace bandit, flake8, isort, and pyupgrade with ruff (#8178) 2023-03-15 13:58:25 +01:00
gnome_sort.py Gnome sort : type hints, docstrings, doctests (#2307) 2020-08-14 22:00:08 +02:00
heap_sort.py contribution guidelines checks (#1787) 2020-03-04 13:40:28 +01:00
insertion_sort.py fixes #9002; improve insertion_sort algorithm (#9005) 2023-08-21 16:17:02 -07:00
intro_sort.py Create intro_sort.py (#3877) 2020-11-25 09:54:31 +01:00
iterative_merge_sort.py Fix iter_merge_sort bug (#6153) 2022-05-21 22:02:53 +08:00
merge_insertion_sort.py Reduce the complexity of sorts/merge_insertion_sort.py (#7954) 2022-12-24 15:57:28 +01:00
merge_sort.py Format docs (#7821) 2022-10-29 08:26:19 +02:00
msd_radix_sort.py Make some ruff fixes (#8154) 2023-03-01 17:23:33 +01:00
natural_sort.py Create natural_sort.py (#3286) 2020-10-15 13:45:17 +02:00
normal_distribution_quick_sort.md Remove useless code in doctests (#7733) 2022-10-27 22:52:00 +02:00
odd_even_sort.py pre-commit: Upgrade psf/black for stable style 2023 (#8110) 2023-02-01 18:44:54 +05:30
odd_even_transposition_parallel.py [pre-commit.ci] pre-commit autoupdate (#9013) 2023-08-29 15:18:10 +02:00
odd_even_transposition_single_threaded.py Fix word typos in comments (#4928) 2021-10-04 12:07:58 +08:00
pancake_sort.py contribution guidelines checks (#1787) 2020-03-04 13:40:28 +01:00
patience_sort.py fix: comment in patience sort (#4972) 2021-10-04 11:33:42 +08:00
pigeon_sort.py Pyupgrade to Python 3.9 (#4718) 2021-09-07 13:37:03 +02:00
pigeonhole_sort.py Create codespell.yml (#1698) 2020-01-18 13:24:33 +01:00
quick_sort_3_partition.py Quick sort with lomuto partition (#3875) 2021-02-17 15:28:50 +01:00
quick_sort.py Make some ruff fixes (#8154) 2023-03-01 17:23:33 +01:00
radix_sort.py refactor: Move constants outside of variable scope (#7262) 2022-10-16 15:03:29 +05:30
README.md Fix typos (#9076) 2023-09-23 10:53:09 +02:00
recursive_bubble_sort.py Optimized recursive_bubble_sort (#2410) 2020-09-10 10:31:26 +02:00
recursive_insertion_sort.py Remove useless code in doctests (#7733) 2022-10-27 22:52:00 +02:00
recursive_mergesort_array.py fix: use += in sorts/recursive_mergesort_array.py (#5019) 2021-10-27 00:43:46 +08:00
recursive_quick_sort.py Make some ruff fixes (#8154) 2023-03-01 17:23:33 +01:00
selection_sort.py contribution guidelines checks (#1787) 2020-03-04 13:40:28 +01:00
shell_sort.py Optimization shell sort (#4119) 2021-02-26 09:01:50 +08:00
shrink_shell_sort.py pre-commit: Upgrade psf/black for stable style 2023 (#8110) 2023-02-01 18:44:54 +05:30
slowsort.py Pyupgrade to Python 3.9 (#4718) 2021-09-07 13:37:03 +02:00
stooge_sort.py pre-commit: Upgrade psf/black for stable style 2023 (#8110) 2023-02-01 18:44:54 +05:30
strand_sort.py fix: no implicit optional (#7984) 2022-11-15 14:55:14 +01:00
tim_sort.py Make some ruff fixes (#8154) 2023-03-01 17:23:33 +01:00
topological_sort.py Add typing to topological_sort.py (#9650) 2023-10-03 21:47:03 -04:00
tree_sort.py Add pep8-naming to pre-commit hooks and fixes incorrect naming conventions (#7062) 2022-10-13 00:54:20 +02:00
unknown_sort.py Set the Python file maximum line length to 88 characters (#2122) 2020-06-16 10:09:19 +02:00
wiggle_sort.py Wiggle sort (#2419) 2020-09-25 09:18:00 +02:00

Sorting Algorithms

Sorting is the process of putting data in a specific order. The way to arrange data in a specific order is specified by the sorting algorithm. The most typical orders are lexical or numerical. The significance of sorting lies in the fact that, if data is stored in a sorted manner, data searching can be highly optimised. Another use for sorting is to represent data in a more readable manner.

This section contains a lot of important algorithms that help us to use sorting algorithms in various scenarios.

References