title: Would this function be o(n) time complexity?
body: <p>I'm currently in a data structures class, would this function be considered O(N)? My thinking was due to the while loop not having a direct correlation to the for loop, it's still O(N)? If more information/code is needed for better context, I don't mind editing the post.</p>
  <p>I appreciate any clarification.</p>
  <pre class="lang-py prettyprint-override"><code>input_array = [7, 3, 4, 1, 8]
  new_min_heap = []
  
  for index in range(0, len(input_array)):
    val = input_array[index]
  
    new_min_heap.append(val)
  
    # if new_min_heap has other values, start swappin
    if len(new_min_heap) &gt; 1:
      
      parent_index = get_parent_index(index)
      parent_val = new_min_heap[parent_index]
  
      while val &lt; parent_val:
          new_min_heap.swap(index, parent_index)
  
          val = parent_val
          parent_index = get_parent_index(parent_index)
          parent_val = new_min_heap[parent_index]
  
  </code></pre>