Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2854031

Browse files
committed
Replace let with var
1 parent 03f4820 commit 2854031

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/data-structures/size-balanced-tree.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
exports.Nil = Nil;
7575

7676
function updateChild(node, newChild) {
77-
let parent = node.parent;
77+
var parent = node.parent;
7878
if (parent !== Nil) {
7979
if (parent.right === node) {
8080
parent.right = newChild;
@@ -172,7 +172,7 @@
172172

173173
function maintainSizeBalancedTree(node) {
174174
while (node.parent !== Nil) {
175-
let childNode = node;
175+
var childNode = node;
176176
node = node.parent;
177177
if (node.left == childNode) {
178178
node = maintain(node, true);
@@ -236,8 +236,8 @@
236236
* @param {Object} value Value.
237237
*/
238238
exports.SBTree.prototype.push = function (value) {
239-
let node = findRightMost(this._root);
240-
let newNode = new Node(value, node, Nil, Nil, 1);
239+
var node = findRightMost(this._root);
240+
var newNode = new Node(value, node, Nil, Nil, 1);
241241
if (node !== Nil) node.right = newNode;
242242
this._root = maintainSizeBalancedTree(newNode);
243243
return newNode;
@@ -251,9 +251,9 @@
251251
};
252252

253253
exports.SBTree.prototype.getIndex = function(node) {
254-
let index = node.left.size;
254+
var index = node.left.size;
255255
while (node != this._root) {
256-
let parent = node.parent;
256+
var parent = node.parent;
257257
if (parent.right === node) {
258258
index += parent.left.size + 1;
259259
}
@@ -266,8 +266,8 @@
266266
if (pos >= this._root.size) {
267267
return this.push(value)
268268
}
269-
let node = findNodeAtPos(this._root, pos);
270-
let newNode
269+
var node = findNodeAtPos(this._root, pos);
270+
var newNode
271271
if (node.left === Nil) {
272272
newNode = new Node(value, node, Nil, Nil, 1);
273273
node.left = newNode;
@@ -284,8 +284,8 @@
284284
if (pos >= this._root.size) {
285285
return Nil; // There is no element to remove
286286
}
287-
let node = findNodeAtPos(this._root, pos);
288-
let maintainNode;
287+
var node = findNodeAtPos(this._root, pos);
288+
var maintainNode;
289289

290290
/*
291291
Before remove:
@@ -313,7 +313,7 @@
313313
314314
*/
315315
if (node.left !== Nil){
316-
let LRM = findRightMost(node.left);
316+
var LRM = findRightMost(node.left);
317317
updateChild(node, node.left)
318318
LRM.right = node.right
319319
if (LRM.right === Nil) {
@@ -323,7 +323,7 @@
323323
maintainNode = LRM.right;
324324
}
325325
} else if (node.right !== Nil) {
326-
let RLM = findLeftMost(node.right);
326+
var RLM = findLeftMost(node.right);
327327
updateChild(node, node.right)
328328
RLM.left = node.left
329329
if (RLM.left === Nil) {

0 commit comments

Comments
 (0)