Skip to content

Instantly share code, notes, and snippets.

@nonrational
Created April 3, 2012 17:44
Show Gist options
  • Save nonrational/2294049 to your computer and use it in GitHub Desktop.
Save nonrational/2294049 to your computer and use it in GitHub Desktop.
recursive print 1-10
// 0 <----- root_node
// / \
// 1 2
// / \ \
// 3 4 5
// / / \ \
// 6 7 8 9
function print_node(n){
console.log(n);
if(has_left_child) print_node(n);
if(has_right_child) print_node(n);
};
print_node(root_node);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment