Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flex-algo

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flex-algo - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

8

lib/binaryTree.d.ts

@@ -7,7 +7,11 @@ export declare class BinaryNode {

}
type BinNode = BinaryNode | null | undefined;
export declare class BinaryTree {
root: BinaryNode | null;
root: BinNode;
constructor();
insert(data: (number | null)[]): BinaryNode | null | undefined;
insert(data: (number | null)[]): BinNode;
levelOrder(): (number | undefined)[][];
_depth(node: BinaryNode | null | undefined): number;
depth(): number;
}
export {};

@@ -78,4 +78,22 @@ "use strict";

};
BinaryTree.prototype._depth = function (node) {
if (node == null)
return 0;
if ((node === null || node === void 0 ? void 0 : node.left) === null && node.right === null)
return 1;
var leftDepth = 0;
var rightDepth = 0;
if (node.left !== null) {
leftDepth = this._depth(node.left) + 1;
}
if (node.right !== null) {
rightDepth = this._depth(node.right) + 1;
}
return leftDepth > rightDepth ? leftDepth : rightDepth;
};
BinaryTree.prototype.depth = function () {
return this._depth(this.root);
};
return BinaryTree;
}());
exports.BinaryTree = BinaryTree;
{
"name": "flex-algo",
"version": "0.1.4",
"version": "0.1.5",
"description": "\"SDK for commonly used data structure and algorithms\"",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc