sorts.tree_sort¶
Tree_sort algorithm.
Build a Binary Search Tree and then iterate thru it to get a sorted list.
Classes¶
Functions¶
|
Module Contents¶
- class sorts.tree_sort.Node¶
- __iter__() collections.abc.Iterator[int] ¶
- __len__() int ¶
- insert(val: int) None ¶
- val: int¶
- sorts.tree_sort.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