mgechev / javascript-algorithms

💻 JavaScript implementations of computer science algorithms
https://mgechev.github.io/javascript-algorithms/
MIT License
7.83k stars 1.27k forks source link

bug in avl tree data structure #139

Closed GreedyBlade closed 4 years ago

GreedyBlade commented 6 years ago

Remove operation in avl tree does not work.

  1. The remove function accepts a param with Number or String value, but in the line 605 return this.remove(min); will pass a Node param to this function.
  2. In _getNodesToRestructureRemove function, line 114, y = (z._left === y) ? z._right : z._left;, this condition z._left === y is always false
yuzhouChen commented 5 years ago

Can I try to fix it