From 3e8fb0b5b6caa6e6141df635bf5a3372b7e5b839 Mon Sep 17 00:00:00 2001 From: Mae Date: Wed, 24 Sep 2014 09:19:55 -0500 Subject: [PATCH] Completed preorder and inorder --- lib/traverse.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/traverse.rb b/lib/traverse.rb index 2437cfd..48976d2 100644 --- a/lib/traverse.rb +++ b/lib/traverse.rb @@ -20,11 +20,15 @@ def self.root_only(tree) end def self.with_preorder(node) - # TODO + capture(node.data) + with_preorder(node.left_child) if node.left_child + with_preorder(node.right_child) if node.right_child end def self.with_inorder(node) - # TODO + with_inorder(node.left_child) if node.left_child + capture(node.data) + with_inorder(node.right_child) if node.right_child end def self.with_postorder(node)