mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 17:34:49 +08:00
Pyupgrade to Python 3.9 (#4718)
* Pyupgrade to Python 3.9 * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@ -4,10 +4,10 @@ It used the binary representation of the integers to sort
|
||||
them.
|
||||
https://en.wikipedia.org/wiki/Radix_sort
|
||||
"""
|
||||
from typing import List
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
def msd_radix_sort(list_of_ints: List[int]) -> List[int]:
|
||||
def msd_radix_sort(list_of_ints: list[int]) -> list[int]:
|
||||
"""
|
||||
Implementation of the MSD radix sort algorithm. Only works
|
||||
with positive integers
|
||||
@ -36,7 +36,7 @@ def msd_radix_sort(list_of_ints: List[int]) -> List[int]:
|
||||
return _msd_radix_sort(list_of_ints, most_bits)
|
||||
|
||||
|
||||
def _msd_radix_sort(list_of_ints: List[int], bit_position: int) -> List[int]:
|
||||
def _msd_radix_sort(list_of_ints: list[int], bit_position: int) -> list[int]:
|
||||
"""
|
||||
Sort the given list based on the bit at bit_position. Numbers with a
|
||||
0 at that position will be at the start of the list, numbers with a
|
||||
@ -74,7 +74,7 @@ def _msd_radix_sort(list_of_ints: List[int], bit_position: int) -> List[int]:
|
||||
return res
|
||||
|
||||
|
||||
def msd_radix_sort_inplace(list_of_ints: List[int]):
|
||||
def msd_radix_sort_inplace(list_of_ints: list[int]):
|
||||
"""
|
||||
Inplace implementation of the MSD radix sort algorithm.
|
||||
Sorts based on the binary representation of the integers.
|
||||
@ -109,7 +109,7 @@ def msd_radix_sort_inplace(list_of_ints: List[int]):
|
||||
|
||||
|
||||
def _msd_radix_sort_inplace(
|
||||
list_of_ints: List[int], bit_position: int, begin_index: int, end_index: int
|
||||
list_of_ints: list[int], bit_position: int, begin_index: int, end_index: int
|
||||
):
|
||||
"""
|
||||
Sort the given list based on the bit at bit_position. Numbers with a
|
||||
|
Reference in New Issue
Block a user