Skip to content

Commit

Permalink
Merge pull request #24 from datastructures-js/development
Browse files Browse the repository at this point in the history
comments
  • Loading branch information
eyas-ranjous authored Apr 13, 2020
2 parents cbe5e9c + e7c3d3a commit 73d71de
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/avlTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const AvlTreeNode = require('./avlTreeNode');
class AvlTree extends BinarySearchTree {
/**
* @private
* applies the proper rotation on nodes after an insert or remove
* applies the proper rotation on a node during insert or remove
* @param {AvlTreeNode} node
*/
_balanceNode(node) {
Expand Down Expand Up @@ -81,12 +81,12 @@ class AvlTree extends BinarySearchTree {

if (key < node.getKey()) {
const newNode = this.insert(key, value, node.getLeft());
this._balanceNode(node); // back-tracking
this._balanceNode(node); // backward-tracking
return newNode;
}

const newNode = this.insert(key, value, node.getRight());
this._balanceNode(node); // back-tracking
this._balanceNode(node); // backward-tracking
return newNode;
}

Expand Down

0 comments on commit 73d71de

Please sign in to comment.