0 out of 464 challenges solved

Shell Sort Implementation

Write a function `shell_sort` that takes a list of integers as input and sorts it in ascending order using the Shell Sort algorithm.

Shell Sort is an in-place comparison-based sorting algorithm that generalizes insertion sort by allowing the exchange of items that are far apart. The method starts by sorting pairs of elements far apart from each other, then progressively reducing the gap between elements to be compared.

#### Function Signature
```python [main.nopy]
def shell_sort(my_list: list[int]) -> list[int]:
```

#### Example Usage
```python [main.nopy]
print(shell_sort([12, 23, 4, 5, 3, 2, 12, 81, 56, 95]))  # Output: [2, 3, 4, 5, 12, 12, 23, 56, 81, 95]
print(shell_sort([24, 22, 39, 34, 87, 73, 68]))          # Output: [22, 24, 34, 39, 68, 73, 87]
print(shell_sort([32, 30, 16, 96, 82, 83, 74]))          # Output: [16, 30, 32, 74, 82, 83, 96]
```

#### Constraints
- The input list will contain at least one element.
- The elements of the list will be integers.
def shell_sort(my_list: list[int]) -> list[int]:
    """
    Sorts a list of integers in ascending order using the Shell Sort algorithm.

    Args:
        my_list (list[int]): The list of integers to sort.

    Returns:
        list[int]: The sorted list.
    """
    # Implement the Shell Sort algorithm here
    pass