We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4b98a51 commit a3edd48Copy full SHA for a3edd48
lib/traverse.rb
@@ -20,13 +20,15 @@ def self.root_only(tree)
20
end
21
22
def self.with_preorder(node)
23
- # TODO
+ capture(node.data)
24
+ with_preorder(node.left_child) if node.left_child
25
+ with_preorder(node.right_child) if node.right_child
26
27
28
def self.with_inorder(node)
- with_inorder(node.left_child)
29
+ with_inorder(node.left_child) if node.left_child
30
capture(node.data)
- with_inorder(node.right_child)
31
+ with_inorder(node.right_child) if node.right_child
32
33
34
def self.with_postorder(node)
0 commit comments