

def     a__  (	UpperCAmelCase							:    Union[str, Any]       ,				UpperCAmelCase							:    Dict       ,				UpperCAmelCase							:    Optional[int]    )						->		Any:
  UpperCAmelCase :							Optional[int]								=				index
  UpperCAmelCase :							List[Any]								=				2 * index + 1
  UpperCAmelCase :							Dict								=				2 * index + 2
  if left_index < heap_size and unsorted[left_index] > unsorted[largest]:
    UpperCAmelCase :							Dict								=				left_index

  if right_index < heap_size and unsorted[right_index] > unsorted[largest]:
    UpperCAmelCase :							int								=				right_index

  if largest != index:
    UpperCAmelCase :							str								=				unsorted[index], unsorted[largest]
    heapify(UpperCAmelCase       ,				UpperCAmelCase       ,				UpperCAmelCase    )

def     a__  (	UpperCAmelCase							:    Dict    )						->		Union[str, Any]:
  UpperCAmelCase :							int								=				len(UpperCAmelCase    )
  for i in range(n // 2 - 1       ,				-1       ,				-1    ):
    heapify(UpperCAmelCase       ,				UpperCAmelCase       ,				UpperCAmelCase    )
  for i in range(n - 1       ,				0       ,				-1    ):
    UpperCAmelCase :							Optional[int]								=				unsorted[i], unsorted[0]
    heapify(UpperCAmelCase       ,				0       ,				UpperCAmelCase    )
  return unsorted


if __name__ == "__main__":
     _lowerCamelCase       :     List[str]           =							input("Enter numbers separated by a comma:\n").strip()
     _lowerCamelCase       :     List[Any]           =							[int(item) for item in user_input.split(",")]
     print(heap_sort(unsorted))








from __future__ import annotations

from collections import deque
from queue import Queue
from timeit import timeit

_lowerCamelCase       :     Optional[int]           =							{
    "A": ["B", "C"],
    "B": ["A", "D", "E"],
    "C": ["A", "F"],
    "D": ["B"],
    "E": ["B", "F"],
    "F": ["C", "E"],
}

def     a__  (	UpperCAmelCase							:    dict       ,				UpperCAmelCase							:    str    )						->		list[str]:
  UpperCAmelCase :							Dict								=				{start}
  UpperCAmelCase :							Optional[int]								=				[start]
  UpperCAmelCase :							Queue								=				Queue()
  queue.put(UpperCAmelCase    )
  while not queue.empty():
    UpperCAmelCase :							List[Any]								=				queue.get()
    for w in graph[v]:
      if w not in explored:
        explored.add(UpperCAmelCase    )
        result.append(UpperCAmelCase    )
        queue.put(UpperCAmelCase    )
  return result

def     a__  (	UpperCAmelCase							:    dict       ,				UpperCAmelCase							:    str    )						->		list[str]:
  UpperCAmelCase :							str								=				{start}
  UpperCAmelCase :							List[str]								=				[start]
  UpperCAmelCase :							Union[str, Any]								=				deque([start]    )
  while queue:
    UpperCAmelCase :							Dict								=				queue.popleft()
    for child in graph[v]:
      if child not in visited:
        visited.add(UpperCAmelCase    )
        result.append(UpperCAmelCase    )
        queue.append(UpperCAmelCase    )
  return result

def     a__  (	UpperCAmelCase							:    str    )						->		None:
  UpperCAmelCase :							Optional[int]								=				f'''from __main__ import G, {name}'''
  UpperCAmelCase :							Tuple								=				10_000
  UpperCAmelCase :							Any								=				timeit(f'''{name}(G, \'A\')'''       ,				setup=UpperCAmelCase       ,				number=UpperCAmelCase    )
  print(f'''{name:<35} finished {number} runs in {res:.5f} seconds'''    )


if __name__ == "__main__":
     import doctest

     doctest.testmod()

     benchmark_function("breadth_first_search")
     benchmark_function("breadth_first_search_with_deque")
     # breadth_first_search                finished 10000 runs in 0.20999 seconds
     # breadth_first_search_with_deque     finished 10000 runs in 0.01421 seconds





