EN
My tools

Binary Tree Visualizer & Traversal Calculator

Build a binary tree from a level-order list (with nulls) or a BST insertion order, draw it, and get preorder, inorder, postorder and level order traversals.

Preorder (root, left, right)
F B A D C E G I H
Inorder (left, root, right)
A B C D E F G H I
Postorder (left, right, root)
A C E D B H I G F
Level order
F B G A D I C E H
Tree
Nodes
9
Height
3
4 levels
Leaves
4

Height counts edges on the longest root-to-leaf path (a single node has height 0); levels count nodes on it.

Properties
PropertyAnswerMeaning
Binary search treeYesin-order traversal is strictly increasing
Height-balanced (AVL)Nosubtree heights differ by at most 1 at every node
CompleteNoevery level full except the last, filled from the left
FullNoevery node has 0 or 2 children
PerfectNofull with all leaves at the same depth (2^levels − 1 nodes)
Internal nodes5nodes with at least one child
My tools →
Advertisement

Tree exercises and coding interviews describe a binary tree either as a level-order list with nulls — [1, 2, 3, null, 4] — or as values inserted one by one into a binary search tree. This tool builds the tree from either form, draws it, and lists the preorder, inorder, postorder and level-order traversals along with the height, the number of leaves, and whether the tree is a BST, balanced, complete, full or perfect. You can also insert and delete values in a BST and see the result.

How to use this tool

  1. Choose how the tree is given: a level-order list with nulls, or values inserted into a BST.
  2. Type the values, separated by commas or spaces.
  3. Optionally insert or delete values (binary search trees only).
  4. Read the traversals, the drawing and the properties table.

Formula

preorder = root, left, right · inorder = left, root, right · postorder = left, right, root · level order = breadth-first, left to right

In a level-order list each node takes the next two entries as its left and right child, and null marks a missing child, as on LeetCode. BST insertion goes left for smaller values and right for larger ones; duplicates are skipped. Deleting a node with two children copies the in-order successor (or predecessor) into it and removes that node. Values are compared as numbers when all are numbers, otherwise as text. Height counts edges, so a single node has height 0.

Example

The sample is the tree from Wikipedia's tree-traversal article, with root F. Preorder gives F B A D C E G I H, inorder A B C D E F G H I (sorted, so it is a BST), postorder A C E D B H I G F and level order F B G A D I C E H. It has 9 nodes, 4 leaves (A, C, E, H) and height 3; it is not complete, because G has no left child while I is filled in.

Frequently asked questions

Which traversal gives sorted output?

Inorder — but only for a binary search tree. For any other tree, inorder simply visits left subtree, node, right subtree.

Can I rebuild a tree from two traversals?

Preorder or postorder together with inorder determine a tree with distinct values uniquely. Here, enter it as a level-order list or as BST insertions.

What is the difference between complete, full and perfect?

Full: every node has 0 or 2 children. Complete: all levels are full except possibly the last, which is filled from the left. Perfect: full and all leaves on the same level.

Sources

Last updated:

Cite or embed this tool
APA

kakaoCalc. (2026, November 8). Binary Tree Visualizer & Traversal Calculator. https://kakao.mobile/tools/binary-tree-visualizer/

MLA

“Binary Tree Visualizer & Traversal Calculator.” kakaoCalc, 8 Nov. 2026, kakao.mobile/tools/binary-tree-visualizer/.

Paste this code into your page. The widget runs in your visitors' browsers, shows no ads and keeps a link back to this page. Embedding terms

Advertisement