Insert Sort
Add your data below:
Invalid user input
Try data with more numbers
Input Data
Sorted Data
Insert Sort source code
def sort(arr: List[int]) -> List[int]:
for index in range(1, len(arr)):
current_val = arr[index]
j = index - 1
while (j >= 0 and current_val < arr[j]):
arr[j + 1] = arr[j]
j -= 1
arr[j + 1] = current_val
return arr