hello-algo
hello-algo copied to clipboard
Update insertion_sort.py
Type Annotation Issue: The type annotation list[int] may not be compatible with all Python versions. Use List[int] from the typing module for broader compatibility.
Variable Naming: The variable name base could be more descriptive. Consider renaming it to something like current_value for clarity.
Redundant Comparison: The condition nums[j] > base in the while loop is redundant. It can be simplified to directly compare nums[j] with nums[j+1], improving readability.
These changes improve the code's readability and maintainability without altering its functionality.