dumb-binary-tree

0.0.3 • Public • Published

What's this?

I want to create the test data to solve the binary tree problem in competition programming like leetcode. There are many problems related to the binary tree in competitive programming. But it's a tough work to create test data. This library help us to create the simple binary tree data.

How To Install

$ npm i dumb-binary-tree

How To Use

const { binary } = require("dumb-binary-tree");
console.log(binary([1, 2, 3]));
// {
//   val: 1,
//   left: { val: 2, left: undefined, right: undefined },
//   right: { val: 3, left: undefined, right: undefined }
// }

console.log(binary([1, 2, null, null, 3]));
// {
//   val: 1,
//   left: {
//     val: 2,
//     left: undefined,
//     right: { val: 3, left: undefined, right: undefined }
//   },
//   right: undefined
// }

Readme

Keywords

none

Package Sidebar

Install

npm i dumb-binary-tree

Weekly Downloads

4

Version

0.0.3

License

MIT

Unpacked Size

8.72 kB

Total Files

12

Last publish

Collaborators

  • rchaser53