Releases: joowani/binarytree
4.0.0
-
Binarytree version 3.0.0 silently placed a restriction allowing only integers as node values. This was to avoid edge cases that couldn't be handled gracefully (e.g. user-supplied values without random generation or comparison). Pretty printing the tree was also an issue when the
__repr__of these custom values were too lengthy (tree rendering would break). There were many other technical issues with accepting custom values (which, by the way, is whybinarytree.setupfunction was removed). Hopefully in the future, all these challenges are solved sobinarytree.setupmethod can be added back again. In the meantime, integers were thought to be enough for the purpose of practicing tree algorithms. But the restriction seemed unnecessarily strong, which is why in this version, support for all number types (e.g. int, float, decimal.Decimal) have been added back. -
Refactored exception names and messages for consistency and clarity.
-
Node.__iter__now yields node instances instead of node values (see here for details). -
Added new method
Node.values, which returns the list representation of the binary tree (i.e. node values in level order). This is essentially the replacement for the oldNode.__iter__(see here for details).
3.0.1
3.0.0
-
Full documentation is now here!
-
Complete overhaul (with non-backward compatible API changes):
- Many new methods added to binarytree.Node class.
- Replaced
binarytree.convertmethod with binarytree.build and builtin iter method - Renamed
binarytree.Node.showtobinarytree.Node.pprint - Removed functions such as
binarytree.subtree,binarytree.pruneandbinarytree.leafs. Now all introspection & management of trees and nodes are done through methods provided by binarytree.Node. - Removed
customizemethod as it was unnecessarily complicating things. If you want to use your own custom node, you can always subclass binarytree.Node. - Added binarytree specific exceptions.
- Some new features include level-order based indexing and traversals (inorder, preorder, postorder). Again, check them out in the new documentation!
- Add perfect heap and BST generation via new
is_perfectboolean parameter.
2.0.1
2.0.0
- Renamed parameter
balancedtois_balancedfor functionbinarytree.tree. - Renamed parameter
maxtois_maxfor functionbinarytree.heap. - Renamed function
binarytree.pprinttobinarytree.show. - Ranamed function
binarytree.setuptobinarytree.customize. - Added new utility functions using level-order node IDs:
binarytree.show_ids,binarytree.show_all,binarytree.subtree,binarytree.prune(view the README for more details and examples). - Added new utility function for getting leaf nodes:
binarytree.leafs. - Removed the ability to pretty print the tree directly using the python
printkeyword (e.g.print(mytree)). New ways to print them aremytree.show()orshow(mytree).
1.1.1
1.1.0
Binary trees in a tree structure (as opposed to a list represenation) using binarytree.Node can now be displayed using Python's builtin print command, and has new methods inspect and to_list, which are equivalent to external functions inspect and convert respectively:
from binarytree import tree
my_tree = tree()
my_tree.to_list()
my_tree.inspect()
print(my_tree) # No need to use pprintDocstrings and documentation are also updated.