A simple web application to visualize a binary tree given it's level order string representation.
Click here to try it out.
To space out the nodes, a simple algorithm is used where the positions of the leaf nodes in the last level are calculated by equally spacing them by a constant factor. In this calculation, the null nodes are also considered as if they were present in the representation of a fully complete binary tree of the same height.
Node is required to run the project locally. To run locally,
- Clone the repository.
- Run
yarn
ornpm i
(if using npm) in the root directory of the project. - Start the development server using
yarn start
ornpm start
.
By default, parcel serves the app at http://localhost:1234
Build the app using yarn build
or npm build
command. The files to be served can be found inside the generated dist
folder post build.