Last active
June 29, 2018 11:25
-
-
Save boxgames1/ef6086cb2a4f41e8a98b9e921eaa2dc4 to your computer and use it in GitHub Desktop.
BinaryTreePreorder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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