Mbpp/635

⚠️ Plus 仅通过 Base: FAIL Plus: PASS
测试评估
指标结果
Base 测试FAIL
Plus 测试PASS
代码长度475 字符
模型生成的代码 (475 字符)
def heap_sort(arr):
    """
    Sorts a list in-place using the heap sort algorithm.
    Returns the sorted list.
    """
    n = len(arr)

    # Build a max heap
    for i in range(n // 2 - 1, -1, -1):
        _sift_down(arr, n, i)

    # Extract elements from the heap one by one
    for i in range(n - 1, 0, -1):
        arr[0], arr[i] = arr[i], arr[0]  # Move current root to end
        _sift_down(arr, i, 0)            # Restore max heap on reduced heap

    return arr
Base 失败测试用例
  • [[1, 3, 5, 7, 9, 2, 4, 6, 8, 0]]
Plus 失败测试用例
  • 无失败测试