Skip to content

Bst delete#11

Open
julienawilson wants to merge 13 commits intomasterfrom
bst-delete
Open

Bst delete#11
julienawilson wants to merge 13 commits intomasterfrom
bst-delete

Conversation

@julienawilson
Copy link
Owner

No description provided.

pre_order(self): Return a generator that returns each node value from pre-order traversal.
post_order(self): Return a generator that returns each node value from post_order traversal.
breadth_first(self): Return a generator returns each node value from breadth-first traversal.

Choose a reason for hiding this comment

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

Seems like a method is missing...

* pre_order(self): Return a generator that returns each node value from pre-order traversal.
* post_order(self): Return a generator that returns each node value from post_order traversal.
* breadth_first(self): Return a generator returns each node value from breadth-first traversal.

Choose a reason for hiding this comment

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

Seems like a method is missing...

b_tree = BinarySearchTree()
b_tree.insert(17)
b_tree.insert(43)
import pdb; pdb.set_trace()

Choose a reason for hiding this comment

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

You probably shouldn't need this on github.

trav_list.enqueue(current_node.right)
yield current_node

def delete(self, value):

Choose a reason for hiding this comment

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

Delete breaks with empty tree. See assignment for how to handle this.

In [2]: bst = BinarySearchTree()

In [3]: bst.delete(1)
---------------------------------------------------------------------------
AttributeError: 'NoneType' object has no attribute 'value'

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.

3 participants