sorts.tree_sort =============== .. py:module:: sorts.tree_sort .. autoapi-nested-parse:: Tree_sort algorithm. Build a Binary Search Tree and then iterate thru it to get a sorted list. Classes ------- .. autoapisummary:: sorts.tree_sort.Node Functions --------- .. autoapisummary:: sorts.tree_sort.tree_sort Module Contents --------------- .. py:class:: Node .. py:method:: __iter__() -> collections.abc.Iterator[int] .. py:method:: __len__() -> int .. py:method:: insert(val: int) -> None .. py:attribute:: left :type: Node | None :value: None .. py:attribute:: right :type: Node | None :value: None .. py:attribute:: val :type: int .. py:function:: tree_sort(arr: list[int]) -> tuple[int, Ellipsis] >>> tree_sort([]) () >>> tree_sort((1,)) (1,) >>> tree_sort((1, 2)) (1, 2) >>> tree_sort([5, 2, 7]) (2, 5, 7) >>> tree_sort((5, -4, 9, 2, 7)) (-4, 2, 5, 7, 9) >>> tree_sort([5, 6, 1, -1, 4, 37, 2, 7]) (-1, 1, 2, 4, 5, 6, 7, 37) # >>> tree_sort(range(10, -10, -1)) == tuple(sorted(range(10, -10, -1))) # True