Skip to content

Conversation

@RicardoColladoRothschild

Solution:
Original Version of the Level() fucntion was on big o O(n).
We remove the while bucle, and use a constat time O(1), by having a field that every time a new TreeNode is created, it takes
parent Level() information (if not null) and inrease by 1. If not Parent exist, it start the root TreeNode with Level = 0

…tant time, due to be using a field that increase one, every time a new child is added (it increase base on father)
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

Successfully merging this pull request may close these issues.

1 participant