Skip to main content

DFS Pre Order

Visits the root first, then the left subtree, then the right subtree.

Interactive Visualization

Loading visualization…

Usage

src/sample/preorder.ts
import { preOrder, Node } from 'athro';

const root = new Node(3);
const result = preOrder(root);