Skip to content

Releases: joowani/binarytree

4.0.0

11 May 20:34
Compare
Choose a tag to compare
  • 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 why binarytree.setup function was removed). Hopefully in the future, all these challenges are solved so binarytree.setup method 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 old Node.__iter__ (see here for details).

3.0.1

20 Dec 22:44
Compare
Choose a tag to compare
  • Add MANIFEST.ini to include LICENSE in the distribution.

3.0.0

19 Dec 14:09
Compare
Choose a tag to compare
  • Full documentation is now here!

  • Complete overhaul (with non-backward compatible API changes):

    • Many new methods added to binarytree.Node class.
    • Replaced binarytree.convert method with binarytree.build and builtin iter method
    • Renamed binarytree.Node.show to binarytree.Node.pprint
    • Removed functions such as binarytree.subtree, binarytree.prune and binarytree.leafs. Now all introspection & management of trees and nodes are done through methods provided by binarytree.Node.
    • Removed customize method 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_perfect boolean parameter.

2.0.1

20 Sep 04:55
Compare
Choose a tag to compare
  • Fixed a bug in binary search tree check.
  • Made a minor optimization in balanced tree check.

2.0.0

07 Aug 09:19
Compare
Choose a tag to compare
  • Renamed parameter balanced to is_balanced for function binarytree.tree.
  • Renamed parameter max to is_max for function binarytree.heap.
  • Renamed function binarytree.pprint to binarytree.show.
  • Ranamed function binarytree.setup to binarytree.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 print keyword (e.g. print(mytree)). New ways to print them are mytree.show() or show(mytree).

1.1.1

12 Jan 05:53
Compare
Choose a tag to compare
  • Improved the documentation for _build_str function.
  • Refactored the _build_str function to improve clarity for the readers.

1.1.0

10 Oct 06:10
Compare
Choose a tag to compare

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 pprint

Docstrings and documentation are also updated.

1.0.0

08 Oct 22:29
Compare
Choose a tag to compare

Initial release