sorts.selection_sort

Attributes

user_input

Functions

selection_sort(→ list[int])

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