sorts.selection_sort¶
Attributes¶
Functions¶
|
Sorts a list in ascending order using the selection sort algorithm. |
Module Contents¶
- sorts.selection_sort.selection_sort(collection: list[int]) list[int] ¶
Sorts a list in ascending order using the selection sort algorithm.
- Parameters:
collection – A list of integers to be sorted.
- Returns:
The sorted list.
Examples: >>> selection_sort([0, 5, 3, 2, 2]) [0, 2, 2, 3, 5]
>>> selection_sort([]) []
>>> selection_sort([-2, -5, -45]) [-45, -5, -2]
- sorts.selection_sort.user_input¶