Skip to content

Instantly share code, notes, and snippets.

@jpedrosa
Created May 22, 2009 15:33
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 jpedrosa/116199 to your computer and use it in GitHub Desktop.
Save jpedrosa/116199 to your computer and use it in GitHub Desktop.
function Node(children){
Node.counter += 1
this._children = children
}
Node.counter = 0
function make_tree(depth){
if (depth > 1){
return new Node ([make_tree(depth - 1), make_tree(depth - 1)])
} else {
return new Node ([])
}
}
function main(){
depth = system.k7.ENV.argc > 2 ? system.k7.ENV.argv[2] : 0
root = make_tree(depth)
system.k7.shell.print(Node.counter)
}
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment