Skip to content

Instantly share code, notes, and snippets.

@boxgames1
Last active June 29, 2018 11:25
Show Gist options
  • Save boxgames1/ef6086cb2a4f41e8a98b9e921eaa2dc4 to your computer and use it in GitHub Desktop.
Save boxgames1/ef6086cb2a4f41e8a98b9e921eaa2dc4 to your computer and use it in GitHub Desktop.
BinaryTreePreorder
preorder(node, fn) {
if (node !== null) {
fn(node);
this.preorder(node.left, fn);
this.preorder(node.right, fn);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment