lib/ruby_algorithms/algorithms/search/graphs/bst.rb
# This is post order traversal (recursive implementation). Notice how the yield
# for visting the node is after the two recursive calls for left and right nodes
# respectively.
This is post order traversal (recursive implementation). Notice how the yield
for visting the node is after the two recursive calls for left and right nodes
respectively.
This is post order traversal ( recursive implementation ) . Notice how the yield for visting the node is after the two recursive calls for left and right nodes respectively .
def post_order(node=@root, &block)
    return if node.nil?
    in_order(node.left, &block)
    in_order(node.right, &block)
    yield node
  end
def post_order ( node = @root , & block ) return if node . nil? in_order ( node . left , & block ) in_order ( node . right , & block ) yield node end
This is post order traversal (recursive implementation).
This is post order traversal ( recursive implementation ) .
node
block