Class: AVLTree::BSTreeTraversal

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-avl/bs_tree_traversal.rb

Instance Method Summary collapse

Instance Method Details

#in_order_array(root_node, attribute = nil) ⇒ Object



12
13
14
# File 'lib/ruby-avl/bs_tree_traversal.rb', line 12

def in_order_array(root_node, attribute = nil)
  in_order(root_node, attribute, [])
end

#in_order_string(root_node, attribute = nil) ⇒ Object



16
17
18
# File 'lib/ruby-avl/bs_tree_traversal.rb', line 16

def in_order_string(root_node, attribute = nil)
  in_order(root_node, attribute, []).join(', ')    
end

#post_order_array(root_node, attribute = nil) ⇒ Object



20
21
22
# File 'lib/ruby-avl/bs_tree_traversal.rb', line 20

def post_order_array(root_node, attribute = nil)
  post_order(root_node, attribute, [])
end

#post_order_string(root_node, attribute = nil) ⇒ Object



24
25
26
# File 'lib/ruby-avl/bs_tree_traversal.rb', line 24

def post_order_string(root_node, attribute = nil)
  post_order(root_node, attribute, []).join(', ')
end

#pre_order_array(root_node, attribute = nil) ⇒ Object



4
5
6
# File 'lib/ruby-avl/bs_tree_traversal.rb', line 4

def pre_order_array(root_node, attribute = nil)
  pre_order(root_node, attribute, [])
end

#pre_order_string(root_node, attribute = nil) ⇒ Object



8
9
10
# File 'lib/ruby-avl/bs_tree_traversal.rb', line 8

def pre_order_string(root_node, attribute = nil)
  pre_order(root_node, attribute, []).join(', ')
end