Question: 
Write a function to check if the given array represents min heap or not.


Model's Code:
def check_min_heap(arr, index):
    n = len(arr)
    left = 2 * index + 1
    right = 2 * index + 2
    if left < n and arr[index] > arr[left]:
        return False
    if right < n and arr[index] > arr[right]:
        return False
    if left < n and not check_min_heap(arr, left):
        return False
    if right < n and not check_min_heap(arr, right):
        return False
    return True



Sample Correct Code:
def check_min_heap(arr, i):
    if 2 * i + 2 > len(arr):
        return True
    left_child = (arr[i] <= arr[2 * i + 1]) and check_min_heap(arr, 2 * i + 1)
    right_child = (2 * i + 2 == len(arr)) or (arr[i] <= arr[2 * i + 2] 
                                      and check_min_heap(arr, 2 * i + 2))
    return left_child and right_child


Asserts:
assert check_min_heap([1, 2, 3, 4, 5, 6], 0) == True
assert check_min_heap([2, 3, 4, 5, 10, 15], 0) == True
assert check_min_heap([2, 10, 4, 5, 3, 15], 0) == False


Tests:
Test 1 of 3: PASS
Test 2 of 3: PASS
Test 3 of 3: PASS

Test 751 of 974: 568/751 (75.63249001331558%): success