Easy Trees

In-order Traversal

Receives an array of integers and interprets it as a binary tree laid out level-order — index i's children live at 2i+1 and 2i+2, the same indexing scheme used by binary heaps. It then walks the tree recursively in-order: fully visit the left subtree, process the current node, then fully visit the right subtree. Returns a new array with the values in the order they were visited. Unlike a binary search tree, this tree has no ordering property, so the result is not necessarily sorted — it reflects the tree's shape, not the values themselves.

Visualization

Input

Algorithm code

Custom input

Saved inputs

References