Tree sort (sorting)

Current realization based on tree sort. Our algorithms can do 2 simple abstract things - add new elem and return sorted container So, below i realized and compare different approaches to implementation

Functions describes

Examples of binary tree, made in the style of OOP

It’s just example of binary sort functions, based or not on his own tree.

class tree_sort.funcs.BaseNodeClass[source]

Abstract Binary Tree Class All other based on this interface

add_node(data: numbers.Integral) → None[source]

add items to data container

tree_data() → collections.abc.Iterator[source]

return sorted items of inner data

class tree_sort.funcs.BisectNodeClass[source]

Based on bisect stdlib, without inner tree

add_node(data: numbers.Integral) → None[source]

add items to data container

tree_data() → collections.abc.Iterator[source]

return sorted items of inner data

class tree_sort.funcs.SingleNodeClass(data: numbers.Integral = None)[source]

All operations and storage takes place inside one class

add_node(data: numbers.Integral) → None[source]

add items to data container

tree_data() → collections.abc.Iterator[source]

return sorted items of inner data

class tree_sort.funcs.TwoNodeClass[source]

Use inner class Node for storage and TwoNodeClass for for everything else based on https://gist.github.com/samidhtalsania/6659380

class Node(key: numbers.Integral)[source]

Inner class of item, which contain info about neightbours

add_node(key: numbers.Integral, _node: tree_sort.funcs.TwoNodeClass.Node = None) → None[source]

add items to data container

tree_data(_node: tree_sort.funcs.TwoNodeClass.Node = None) → collections.abc.Iterator[source]

return sorted items of inner data

Data describes

Generate test data for test performance

tree_sort.data.generate_data(num: int) → List[int][source]

generate data numbers in random order result -> “datalist_*num*”