Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module 5: FTree is incorrect #37

Open
xgillard opened this issue Dec 2, 2020 · 0 comments
Open

Module 5: FTree is incorrect #37

xgillard opened this issue Dec 2, 2020 · 0 comments

Comments

@xgillard
Copy link
Collaborator

xgillard commented Dec 2, 2020

**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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant