测试评估
| 指标 | 结果 |
|---|---|
| Base 测试 | PASS |
| Plus 测试 | PASS |
| 代码长度 | 777 字符 |
模型生成的代码 (777 字符)
def shell_sort(arr):
"""
Sorts the given list using the Shell sort algorithm.
"""
n = len(arr)
gap = n // 2 # initial gap
# Start with a big gap, then reduce the gap
while gap > 0:
# Perform a gapped insertion sort for this gap size.
for i in range(gap, n):
# Save a_copy of arr[i] in temp and make a hole at position i
temp = arr[i]
j = i
# Shift earlier gap-sorted elements up until the correct location for a[i] is found
while j >= gap and arr[j - gap] > temp:
arr[j] = arr[j - gap]
j -= gap
# Put temp (the original a[i]) in its correct location
arr[j] = temp
gap //= 2 # reduce the gap
return arr
Base 失败测试用例
- 无失败测试
Plus 失败测试用例
- 无失败测试