parameters: (self, index)
docstring: sink moves element at index downward to maintain heap invariant
docstring_summary: sink moves element at index downward to maintain heap invariant
docstring_tokens: sink moves element at index downward to maintain heap invariant
function: def sink(self, index):
          """ sink moves element at index downward to maintain heap invariant """
          max_index = index
          left = index * 2
          right = (index * 2) + 1
  
          if left <= self.length():
              if self.data[max_index] < self.data[left]:
                  max_index = left
  
          if right <= self.length():
              if self.data[max_index] < self.data[right]:
                  max_index = right
  
          if max_index != index:
              self.data[index], self.data[max_index] = self.data[max_index], self.data[index]
              self.sink(max_index)
function_tokens: def sink ( self , index ) : max_index = index left = index * 2 right = ( index * 2 ) + 1 if left <= self . length ( ) : if self . data [ max_index ] < self . data [ left ] : max_index = left if right <= self . length ( ) : if self . data [ max_index ] < self . data [ right ] : max_index = right if max_index != index : self . data [ index ] , self . data [ max_index ] = self . data [ max_index ] , self . data [ index ] self . sink ( max_index )