



"""simple docstring"""







class   UpperCamelCase	:




	"""simple docstring"""






	def __init__(     self   ):
			_lowercase				: Optional[Any]     =   [0]
			_lowercase				: List[str]     =   0






	def    lowerCamelCase__					(     self				,UpperCAmelCase_   ):
			_lowercase				: Optional[Any]     =   self.__heap[i]
			while i // 2 > 0:
					if self.__heap[i] > self.__heap[i // 2]:
							_lowercase				: Dict     =   self.__heap[i // 2]
							_lowercase				: Dict     =   temporary
					i //= 2






	def    lowerCamelCase__					(     self				,UpperCAmelCase_   ):
			self.__heap.append(UpperCAmelCase_   )
			self.__size += 1
			self.__swap_up(self.__size   )






	def    lowerCamelCase__					(     self				,UpperCAmelCase_   ):
			while self.__size >= 2 * i:
					if 2 * i + 1 > self.__size:
							_lowercase				: Any     =   2 * i
					else:
							if self.__heap[2 * i] > self.__heap[2 * i + 1]:
									_lowercase				: Optional[Any]     =   2 * i
							else:
									_lowercase				: Optional[Any]     =   2 * i + 1
					_lowercase				: Optional[Any]     =   self.__heap[i]
					if self.__heap[i] < self.__heap[bigger_child]:
							_lowercase				: Any     =   self.__heap[bigger_child]
							_lowercase				: Dict     =   temporary
					_lowercase				: str     =   bigger_child






	def    lowerCamelCase__					(     self   ):
			_lowercase				: Optional[Any]     =   self.__heap[1]
			_lowercase				: str     =   self.__heap[self.__size]
			self.__size -= 1
			self.__heap.pop()
			self.__swap_down(1   )
			return max_value






	@property
	def    lowerCamelCase__					(     self   ):
			return self.__heap[1:]






	def __len__(     self   ):
			return self.__size


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		# create an instance of BinaryHeap
		UpperCAmelCase:  Optional[Any]			     =				BinaryHeap()
		binary_heap.insert(6)
		binary_heap.insert(10)
		binary_heap.insert(15)
		binary_heap.insert(12)
		# pop root(max-values because it is max heap)
		print(binary_heap.pop())  # 15
		print(binary_heap.pop())  # 12
		# get the list and size after operations
		print(binary_heap.get_list)
		print(len(binary_heap))









class 			_lowerCamelCase    :

      """simple docstring"""

      def __init__(  self       :			Optional[Any]			,							snake_case       :			int					):
          __UpperCamelCase			=    data
          __UpperCamelCase			=    42
          __UpperCamelCase			=    42







def        __SCREAMING_SNAKE_CASE (	lowercase_   )							->						None:

    """simple docstring"""


    __UpperCamelCase			=    0
    __UpperCamelCase			=    x




def        __SCREAMING_SNAKE_CASE (	lowercase_       ,  lowercase_   )							->						None:

    """simple docstring"""


    __UpperCamelCase		,   __UpperCamelCase			=    find_set(lowercase_   ), find_set(lowercase_   )
    if x == y:
        return

    elif x.rank > y.rank:
        __UpperCamelCase			=    x
    else:
        __UpperCamelCase			=    y
        if x.rank == y.rank:
            y.rank += 1




def        __SCREAMING_SNAKE_CASE (	lowercase_   )							->						Node:

    """simple docstring"""


    if x != x.parent:
        __UpperCamelCase			=    find_set(x.parent   )
    return x.parent




def        __SCREAMING_SNAKE_CASE (	lowercase_   )							->						set:

    """simple docstring"""


    __UpperCamelCase			=    ({0, 1, 2}, {3, 4, 5})
    for s in sets:
        if node.data in s:
            return s
    __UpperCamelCase			=    F"{node.data} is not in {sets}"
    raise ValueError(lowercase_   )




def        __SCREAMING_SNAKE_CASE (	)							->						None:

    """simple docstring"""


    __UpperCamelCase			=    [Node(lowercase_   ) for i in range(6   )]
    for v in vertex:
        make_set(lowercase_   )

    union_set(vertex[0]       ,  vertex[1]   )
    union_set(vertex[1]       ,  vertex[2]   )
    union_set(vertex[3]       ,  vertex[4]   )
    union_set(vertex[3]       ,  vertex[5]   )

    for nodea in vertex:
        for nodea in vertex:
            if find_python_set(lowercase_   ).isdisjoint(find_python_set(lowercase_   )   ):
                assert find_set(lowercase_   ) != find_set(lowercase_   )
            else:
                assert find_set(lowercase_   ) == find_set(lowercase_   )


if __name__ == "__main__":
 test_disjoint_set()






