




from __future__ import annotations

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

__a		     =   {
    '''A''': ['''B''', '''C'''],
    '''B''': ['''A''', '''D''', '''E'''],
    '''C''': ['''A''', '''F'''],
    '''D''': ['''B'''],
    '''E''': ['''B''', '''F'''],
    '''F''': ['''C''', '''E'''],
}
def  snake_case_					(		SCREAMING_SNAKE_CASE_    ,SCREAMING_SNAKE_CASE_    )      ->			list[str]:
							lowercase__  :	Any        =							{start}
							lowercase__  :	int        =							[start]
							lowercase__  :	Queue        =							Queue()
							queue.put(SCREAMING_SNAKE_CASE_    )
							while not queue.empty():
														lowercase__  :	List[Any]        =							queue.get()
														for w in graph[v]:
																					if w not in explored:
																												explored.add(SCREAMING_SNAKE_CASE_    )
																												result.append(SCREAMING_SNAKE_CASE_    )
																												queue.put(SCREAMING_SNAKE_CASE_    )
							return result
def  snake_case_					(		SCREAMING_SNAKE_CASE_    ,SCREAMING_SNAKE_CASE_    )      ->			list[str]:
							lowercase__  :	List[Any]        =							{start}
							lowercase__  :	List[str]        =							[start]
							lowercase__  :	Union[str, Any]        =							deque([start]    )
							while queue:
														lowercase__  :	Union[str, Any]        =							queue.popleft()
														for child in graph[v]:
																					if child not in visited:
																												visited.add(SCREAMING_SNAKE_CASE_    )
																												result.append(SCREAMING_SNAKE_CASE_    )
																												queue.append(SCREAMING_SNAKE_CASE_    )
							return result
def  snake_case_					(		SCREAMING_SNAKE_CASE_    )      ->			None:
							lowercase__  :	Tuple        =							F"""from __main__ import G, {name}"""
							lowercase__  :	Dict        =							1_00_00
							lowercase__  :	Tuple        =							timeit(F"""{name}(G, 'A')"""    ,setup=SCREAMING_SNAKE_CASE_    ,number=SCREAMING_SNAKE_CASE_    )
							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





def  snake_case_					(		SCREAMING_SNAKE_CASE_    )      ->			list:
							lowercase__  :	Optional[Any]        =							len(SCREAMING_SNAKE_CASE_    )

							# Set the gap value to be decreased by a factor of 1.3
							# after each iteration
							lowercase__  :	Tuple        =							1.3

							# Continue sorting until the gap is 1
							while gap > 1:
														# Decrease the gap value
														lowercase__  :	Tuple        =							int(gap / shrink    )

														# Sort the elements using insertion sort
														for i in range(SCREAMING_SNAKE_CASE_    ,len(SCREAMING_SNAKE_CASE_    )    ):
																					lowercase__  :	int        =							collection[i]
																					lowercase__  :	Union[str, Any]        =							i
																					while j >= gap and collection[j - gap] > temp:
																												lowercase__  :	str        =							collection[j - gap]
																												j -= gap
																					lowercase__  :	List[Any]        =							temp

							return collection


if __name__ == "__main__":
						import doctest

						doctest.testmod()