Ruby-BST/main.rb
# to_a_helper function: unless current node is nil, recursively calls itself on the left child, pushs the current node value to the sorted array, and then recursively calls itself on the right child
to_a_helper function: unless current node is nil, recursively calls itself on the left child, pushs the current node value to the sorted array, and then recursively calls itself on the right child
to_a_helper function : unless current node is nil recursively calls itself on the left child pushs the current node value to the sorted array and then recursively calls itself on the right child
def to_a_helper(node, sorted_array)
    unless node.nil?
      to_a_helper(node.left, sorted_array)
      sorted_array << node.value
      to_a_helper(node.right, sorted_array)
    end
  end
def to_a_helper ( node , sorted_array ) unless node . nil? to_a_helper ( node . left , sorted_array ) sorted_array << node . value to_a_helper ( node . right , sorted_array ) end end
to_a_helper function: unless current node is nil, recursively calls itself on the left child, pushs the current node value to the sorted array, and then recursively calls itself on the right child
to_a_helper function : unless current node is nil recursively calls itself on the left child pushs the current node value to the sorted array and then recursively calls itself on the right child
node
<not_specific>
sorted_array
<not_specific>