Coder Social home page Coder Social logo

Comments (3)

joowani avatar joowani commented on July 19, 2024

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.

canturk avatar canturk commented on July 19, 2024

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.

joowani avatar joowani commented on July 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.