Comparing version 0.1.10 to 0.1.11
@@ -22,3 +22,5 @@ declare class BinaryNode { | ||
leftSideView(): number[]; | ||
_isValid(node: BSTNode, min: number, max: number): boolean; | ||
isValid(): boolean; | ||
} | ||
export {}; |
@@ -141,4 +141,21 @@ "use strict"; | ||
}; | ||
BST.prototype._isValid = function (node, min, max) { | ||
if (node === null) | ||
return true; | ||
if ((node === null || node === void 0 ? void 0 : node.value) <= min || (node === null || node === void 0 ? void 0 : node.value) >= max) { | ||
return false; | ||
} | ||
if (!this._isValid(node.left, min, node.value)) { | ||
return false; | ||
} | ||
if (!this._isValid(node.right, node.value, max)) { | ||
return false; | ||
} | ||
return true; | ||
}; | ||
BST.prototype.isValid = function () { | ||
return this._isValid(this.root, -Infinity, Infinity); | ||
}; | ||
return BST; | ||
}()); | ||
exports.BST = BST; |
{ | ||
"name": "flex-algo", | ||
"version": "0.1.10", | ||
"version": "0.1.11", | ||
"description": "\"SDK for commonly used data structure and algorithms\"", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19906
534