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 installnpx 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:
Other examples can be found in examples
folder.