print-binary-tree
v0.1.0
Published
1. Prebuilt JavaScript `node ./dist/print-binary-tree.js <path-to-json>` 1. Running TypeScript source code:
Downloads
4
Readme
Usage
- Prebuilt JavaScript
node ./dist/print-binary-tree.js <path-to-json>
- Running TypeScript source code:
# with yarn:
yarn install
./node_modules/.bin/ts-node src/print-binary-tree.ts "<path-to-json>"
# with npm:
npm install
npx ts-node src/print-binary-tree.ts "<path-to-json>"
- Install package globally:
npm install -g .
# or
npm install -g print-binary-tree
# or
yarn global add print-binary-tree
print-binary-tree "<path-to-json>"
Data format
Tree is stored in JSON format, all nodes are array of three elements: first is number value, second and third are children, that could be either new node or null.
Examples:
[0, null, null]
[0, [1, null, null], [2, null, null]]
Other examples can be found in examples
folder.