Skip to content

rchaser53/dumb-binary-tree

Repository files navigation

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
// }

About

the simple library to create a binary tree for test code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published