Skip to content

Conversation

@chamberi
Copy link
Owner

No description provided.

CCallahanIV and others added 30 commits January 16, 2017 12:44
…o bst

sdf building a binary search tree.
…ctures into traversal-bst

g
g Lines starting with '#' will be ignocquire post_order_trav. red, and an empty message aborts
"""
if self.root is None:
return 0
return self.calc_depth(self.root.right) - self.calc_depth(self.root.left)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to specs, left heavy is positive

return 0
return self.calc_depth(self.root.right) - self.calc_depth(self.root.left)

def in_order(self):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally like how you are able to have both the generator method, and also be able to simply return the value

self.insert(value)
except TypeError:
self.insert(if_iter)
self._in_order = self.in_order_trav()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if you create a tree with some nodes in it, but then start a traversal, and then add nodes into it before you have completed it?

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.

4 participants