nodes: 0, module; 1, function_definition; 2, function_name:min_heapify; 3, parameters; 4, block; 5, identifier:arr; 6, identifier:start; 7, identifier:simulation; 8, identifier:iteration; 9, expression_statement; 10, comment:# Offset last_parent by the start (last_parent calculated as if start index was 0); 11, comment:# All array accesses need to be offset by start; 12, expression_statement; 13, expression_statement; 14, comment:# Iterate from last parent to first; 15, for_statement; 16, return_statement; 17, comment:""" Min heapify helper for min_heap_sort
      """; 18, assignment; 19, assignment; 20, identifier:parent; 21, call; 22, block; 23, identifier:iteration; 24, identifier:end; 25, binary_operator:len(arr) - 1; 26, identifier:last_parent; 27, binary_operator:(end - start - 1) // 2; 28, identifier:range; 29, argument_list; 30, expression_statement; 31, comment:# Iterate from current_parent to last_parent; 32, while_statement; 33, call; 34, integer:1; 35, parenthesized_expression; 36, integer:2; 37, identifier:last_parent; 38, unary_operator; 39, unary_operator; 40, assignment; 41, comparison_operator:current_parent <= last_parent; 42, comment:# Find lesser child of current_parent; 43, block; 44, identifier:len; 45, argument_list; 46, binary_operator:end - start - 1; 47, integer:1; 48, integer:1; 49, identifier:current_parent; 50, identifier:parent; 51, identifier:current_parent; 52, identifier:last_parent; 53, expression_statement; 54, if_statement; 55, comment:# Swap if child is less than parent; 56, if_statement; 57, identifier:arr; 58, binary_operator:end - start; 59, integer:1; 60, assignment; 61, boolean_operator; 62, block; 63, comparison_operator:arr[child + start] < arr[current_parent + start]; 64, block; 65, comment:# If no swap occured, no need to keep iterating; 66, else_clause; 67, identifier:end; 68, identifier:start; 69, identifier:child; 70, binary_operator:2 * current_parent + 1; 71, comparison_operator:child + 1 <= end - start; 72, comparison_operator:arr[child + start] > arr[
                  child + 1 + start]; 73, expression_statement; 74, subscript; 75, subscript; 76, expression_statement; 77, expression_statement; 78, if_statement; 79, block; 80, binary_operator:2 * current_parent; 81, integer:1; 82, binary_operator:child + 1; 83, binary_operator:end - start; 84, subscript; 85, subscript; 86, assignment; 87, identifier:arr; 88, binary_operator:child + start; 89, identifier:arr; 90, binary_operator:current_parent + start; 91, assignment; 92, assignment; 93, identifier:simulation; 94, block; 95, break_statement; 96, integer:2; 97, identifier:current_parent; 98, identifier:child; 99, integer:1; 100, identifier:end; 101, identifier:start; 102, identifier:arr; 103, binary_operator:child + start; 104, identifier:arr; 105, binary_operator:child + 1 + start; 106, identifier:child; 107, binary_operator:child + 1; 108, identifier:child; 109, identifier:start; 110, identifier:current_parent; 111, identifier:start; 112, pattern_list; 113, line_continuation:\; 114, expression_list; 115, identifier:current_parent; 116, identifier:child; 117, expression_statement; 118, expression_statement; 119, identifier:child; 120, identifier:start; 121, binary_operator:child + 1; 122, identifier:start; 123, identifier:child; 124, integer:1; 125, subscript; 126, subscript; 127, subscript; 128, subscript; 129, assignment; 130, call; 131, identifier:child; 132, integer:1; 133, identifier:arr; 134, binary_operator:current_parent + start; 135, identifier:arr; 136, binary_operator:child + start; 137, identifier:arr; 138, binary_operator:child + start; 139, identifier:arr; 140, binary_operator:current_parent + start; 141, identifier:iteration; 142, binary_operator:iteration + 1; 143, identifier:print; 144, argument_list; 145, identifier:current_parent; 146, identifier:start; 147, identifier:child; 148, identifier:start; 149, identifier:child; 150, identifier:start; 151, identifier:current_parent; 152, identifier:start; 153, identifier:iteration; 154, integer:1; 155, string:"iteration"; 156, identifier:iteration; 157, string:":"; 158, list_splat; 159, identifier:arr
code: def min_heapify(arr, start, simulation, iteration):
      """ Min heapify helper for min_heap_sort
      """
      # Offset last_parent by the start (last_parent calculated as if start index was 0)
      # All array accesses need to be offset by start
      end = len(arr) - 1
      last_parent = (end - start - 1) // 2
  
      # Iterate from last parent to first
      for parent in range(last_parent, -1, -1):
          current_parent = parent
  
          # Iterate from current_parent to last_parent
          while current_parent <= last_parent:
              # Find lesser child of current_parent
              child = 2 * current_parent + 1
              if child + 1 <= end - start and arr[child + start] > arr[
                  child + 1 + start]:
                  child = child + 1
              
              # Swap if child is less than parent
              if arr[child + start] < arr[current_parent + start]:
                  arr[current_parent + start], arr[child + start] = \
                      arr[child + start], arr[current_parent + start]
                  current_parent = child
                  if simulation:
                      iteration = iteration + 1
                      print("iteration",iteration,":",*arr)
              # If no swap occured, no need to keep iterating
              else:
                  break
      return iteration