class_docstr: Binary Heap Class
class_docstr_tok: ["Binary","Heap","Class"]
docstr: Method insert always start by inserting the element at the bottom.
  It inserts rightmost spot so as to maintain the complete tree property.
  Then, it fixes the tree by swapping the new element with its parent,
  until it finds an appropriate spot for the element. It essentially
  perc_up the minimum element
  Complexity: O(logN)
docstr_tok: ["Method","insert","always","start","by","inserting","the","element","at","the","bottom",".","It","inserts","rightmost","spot","so","as","to","maintain","the","complete","tree","property",".","Then",",","it","fixes","the","tree","by","swapping","the","new","element","with","its","parent",",","until","it","finds","an","appropriate","spot","for","the","element",".","It","essentially","perc_up","the","minimum","element","Complexity",":","O","(","logN",")"]
code: def insert(self, val):
      """
      Method insert always start by inserting the element at the bottom.
      It inserts rightmost spot so as to maintain the complete tree property.
      Then, it fixes the tree by swapping the new element with its parent,
      until it finds an appropriate spot for the element. It essentially
      perc_up the minimum element
      Complexity: O(logN)
      """
      self.heap.append(val)
      self.current_size = self.current_size + 1
      self.perc_up(self.current_size)
  
      """
          Method min_child returns the index of smaller of 2 children of parent at index i
          """
  
file_path: keon-algos/algorithms/heap/binary_heap.py
imports: from abc import ABCMeta, abstractmethod
label_desc: Use image node_id 3 for calling the BinaryHeap obj's underlying member method code with example usage: obj.insert(val) without return types