Created
November 30, 2008 23:15
-
-
Save matthewrudy/30550 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add(data, tree) | |
if tree.end_of_a_branch? && tree.ND? | |
tree << data # we add something to the tree | |
else | |
add(data, tree.branch1) # we recurse | |
add(data, tree.branch2) | |
end | |
return tree # we always return the tree | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment