Skip to content

Instantly share code, notes, and snippets.

@fabslab
Created December 4, 2013 01:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabslab/c2f99336ea304cc23c54 to your computer and use it in GitHub Desktop.
Save fabslab/c2f99336ea304cc23c54 to your computer and use it in GitHub Desktop.
// in-order binary tree traversal, returns array containing each node's value
function inOrder(node) {
if (node == null) return [];
return inOrder(node.left).concat([node.value]).concat(inOrder(node.right));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment