Skip to content

Instantly share code, notes, and snippets.

@fabslab fabslab/inOrder.js
Created Dec 4, 2013

Embed
What would you like to do?
// 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
You can’t perform that action at this time.