You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**This issue relates to #35 ** (should probably be a subtask of it).
The FTree expects a depth of 0 for leaves. This is not correct as a leaf is a (sub)tree comprising one single node. Therefore, it has a depth 1.
Also, rather than relying on left() == null && right() == null it would be better if all nodes implemented an isLeaf() method. That way, leaves could be a Tree implementation totally separated from the Node class. This would be way more functional (akin to the Nil in functional lists).
The text was updated successfully, but these errors were encountered:
**This issue relates to #35 ** (should probably be a subtask of it).
The FTree expects a depth of 0 for leaves. This is not correct as a leaf is a (sub)tree comprising one single node. Therefore, it has a depth 1.
Also, rather than relying on
left() == null && right() == null
it would be better if all nodes implemented anisLeaf()
method. That way, leaves could be aTree
implementation totally separated from theNode
class. This would be way more functional (akin to theNil
in functional lists).The text was updated successfully, but these errors were encountered: