Comparing version 0.1.6 to 0.1.7
@@ -18,3 +18,5 @@ export declare class BinaryNode { | ||
rightSideView(): NodeValueType[]; | ||
_leftSideView(node: BinNode, values: NodeValueType[], depth: number): void; | ||
leftSideView(): NodeValueType[]; | ||
} | ||
export {}; |
@@ -115,4 +115,23 @@ "use strict"; | ||
}; | ||
BinaryTree.prototype._leftSideView = function (node, values, depth) { | ||
if (node === null) { | ||
return; | ||
} | ||
if (values.length <= depth) { | ||
values.push(node === null || node === void 0 ? void 0 : node.value); | ||
} | ||
if ((node === null || node === void 0 ? void 0 : node.left) != null) { | ||
this._leftSideView(node.left, values, depth + 1); | ||
} | ||
if ((node === null || node === void 0 ? void 0 : node.right) != null) { | ||
this._leftSideView(node.right, values, depth + 1); | ||
} | ||
}; | ||
BinaryTree.prototype.leftSideView = function () { | ||
var views = []; | ||
this._leftSideView(this.root, views, 0); | ||
return views; | ||
}; | ||
return BinaryTree; | ||
}()); | ||
exports.BinaryTree = BinaryTree; |
{ | ||
"name": "flex-algo", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"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
11022
262