Skip to content
This repository was archived by the owner on Dec 12, 2023. It is now read-only.

Conversation

@caoglish
Copy link
Contributor

@caoglish caoglish commented Feb 5, 2014

add search and delete method in binary search tree in JavaScript.
reference of delete: http://www.algolist.net/Data_structures/Binary_search_tree/Removal

Also I did a few change on add method: if add a existed one, it add nothing and still return root instead of false, so it will not break the chain call.

search return node.

delete return root.

Copy link
Owner

Choose a reason for hiding this comment

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

I would avoid using apply and instead pass in node, num, direction.

@caoglish
Copy link
Contributor Author

caoglish commented Feb 6, 2014

Deleting root is little bit tricky, I fixed it.

blakeembrey added a commit that referenced this pull request Feb 9, 2014
 add search and delete in binary-search-tree.js
@blakeembrey blakeembrey merged commit 5abccba into blakeembrey:master Feb 9, 2014
@blakeembrey
Copy link
Owner

Awesome work!

blakeembrey added a commit that referenced this pull request Sep 9, 2014
 add search and delete in binary-search-tree.js
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants