Comments (3)
Hi @canturk,
Sorry for the late response. I can't remember the details on top of my head, but when I allowed arbitrary node values, there were many awkward edge cases that i could not work around (e.g. user-supplied values were complex objects that did not support random generation or comparison). Pretty printing the tree was also an issue when the __repr__
of values were lengthy (the tree would get really wide). To avoid such future headaches I decided that integer is probably enough for users to practice their algorithms. Floats, however, should be easy to add back so I will consider it. Just out of curiosity, what is your use case with floats that you can't use ints instead?
Best
Joohwan
from binarytree.
Hi Joowani,
Thank you for asking. The reason why I need floating point values in my application is the following.
First, I generate a floating point number between 0 and 1 based on an algorithm in my application. Then I insert that value into the binary tree. This process will iterate until a certain number.
Concerning the data types in binarytree, I understand the reasons why you tried to get rid of other data types. However, in my opinion, every node in a binary tree must support all data values (including custom based data type) without any restriction. And I think it would be wise to restrict the use of the features you mentioned above for only integers and leave the full responsibility and management of other type of objects to the user.
Regards
MC
from binarytree.
Hi @canturk,
It's been a while, but I've finally released binarytree 4.0.0 which adds back support for all "number" type node values (e.g. int, float, decimal.Decimal). You can check out the release notes for full details. As for accepting other user-defined values, I will have to work out all the kinks before I can allow full customization again (no timeline for this yet). Feel free to re-open this issue or send me a message if you have any other problems!
from binarytree.
Related Issues (20)
- License not packaged in pypi release HOT 6
- Build script for archlinux HOT 2
- Error when building tree from list HOT 3
- Feature: Export to graphviz dot format HOT 2
- _is_balanced function returns wrong value HOT 1
- infinite loop while counting size of tree with circular references HOT 2
- Bug in build and levelorder function HOT 3
- Adding a requirements.txt HOT 1
- add `_repr_svg_` for svg display in notebooks HOT 3
- NodeNotFoundError while building from list HOT 3
- Tree with strings HOT 3
- Question about node index HOT 3
- Docs request: link readthedocs page at the top of README HOT 1
- Documentation is missing explanation if this data structure keeps the data balanced (red-black, AVL) or not. HOT 3
- graphviz.exceptions does not contain ExecutableNotFound HOT 1
- Import not working in Colab Notebooks HOT 2
- graphviz's `_repr_svg_()` deprecation causes error on jupyter notebook HOT 1
- is_bst returns incorrect result HOT 1
- Additional functionality HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from binarytree.