Skip to content

Instantly share code, notes, and snippets.

@MauricioRobayo
Last active November 13, 2021 13:28
Show Gist options
  • Save MauricioRobayo/630ff1b5639faff4401b1c50ea8a7a33 to your computer and use it in GitHub Desktop.
Save MauricioRobayo/630ff1b5639faff4401b1c50ea8a7a33 to your computer and use it in GitHub Desktop.
function inOrder(node) {
node.left && this.inOrder(node.left);
console.log(node.val);
node.right && this.inOrder(node.right);
}
function postOrder(node) {
node.left && this.postOrder(node.left);
node.right && this.postOrder(node.right);
console.log(node.val);
}
function preOrder(node) {
console.log(node.val);
node.left && this.preOrder(node.left);
node.right && this.preOrder(node.right);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment