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

Fix remove method in AvlTree: Nodes can not re-balance. #33

Merged
merged 4 commits into from
Sep 24, 2018

Conversation

Bladefidz
Copy link
Contributor

Remove node in AvlTree with auto balancing.

Fix issue: #13

Remove node in AvlTree with auto balancing.

Fix issue: trekhleb#13
…ithms

# Conflicts:
#	src/data-structures/tree/avl-tree/AvlTree.js
@codecov-io
Copy link

codecov-io commented May 30, 2018

Codecov Report

Merging #33 into master will decrease coverage by 0.31%.
The diff coverage is 73.91%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #33      +/-   ##
==========================================
- Coverage     100%   99.68%   -0.32%     
==========================================
  Files          86       86              
  Lines        1883     1906      +23     
  Branches      332      338       +6     
==========================================
+ Hits         1883     1900      +17     
- Misses          0        6       +6
Impacted Files Coverage Δ
src/data-structures/tree/avl-tree/AvlTree.js 92.1% <73.91%> (-7.9%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9f83862...e24706e. Read the comment docs.

@Bladefidz Bladefidz changed the title Add remove method in AvlTree.js Fix AvlTree.js bug and add Red Black Tree. May 30, 2018
@trekhleb
Copy link
Owner

trekhleb commented Jun 2, 2018

Wow, @Bladefidz , thank you for your huge effort! Amount of code is impressive!

I've already pushed Red-Black-Tree implementation though. The main difference between the code in master branch and this PR is that in master the Red-Black tree is based upon Binary Search tree. I think it is good approach to prevent code duplication and also because Red-Black trees are BSTs by definition.

Could you please re-target this pull request so that it purpose would be balancing AVL tree while removing the node from it?

@Bladefidz
Copy link
Contributor Author

Okay @trekhleb, I will modify my PR so only commits on AVLTree will be pulled.

@Bladefidz Bladefidz force-pushed the master branch 2 times, most recently from ddf1fbd to 63e451e Compare June 5, 2018 12:46
@Bladefidz Bladefidz changed the title Fix AvlTree.js bug and add Red Black Tree. Fix AvlTree.js remove() bug Jun 5, 2018
@Bladefidz Bladefidz changed the title Fix AvlTree.js remove() bug Fix AvlTree.remove() bug Jun 5, 2018
@Bladefidz Bladefidz changed the title Fix AvlTree.remove() bug Fix remove method in AvlTree: Nodes can not re-balance. Jun 5, 2018
@trekhleb trekhleb changed the base branch from master to avl-removal September 24, 2018 06:11
@trekhleb
Copy link
Owner

@Bladefidz thank you for PR!

@trekhleb trekhleb merged commit 04e533e into trekhleb:avl-removal Sep 24, 2018
harshes53 referenced this pull request in harshes53/javascript-algorithms Dec 6, 2018
Remove node in AvlTree with auto balancing.

Fix issue: trekhleb#13
shoredata pushed a commit to shoredata/javascript-algorithms that referenced this pull request Mar 28, 2019
Remove node in AvlTree with auto balancing.

Fix issue: trekhleb#13
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