Search
 
SCRIPT & CODE EXAMPLE
 

RUBY

merge two binary trees sloved in ruby

treeNode mergedBinaryTree(treeNode root1, treeNode root2)
{
     if(root1.value == NULL)
        return root2
     if(root2.value == NULL)
        return root1
     root1.value += root2.value
     root1.left = mergedBinaryTree(root1.left, root2.left)
     root1.right = mergedBinaryTree(root1.right, root1.right)
     return root1
}
Comment

PREVIOUS NEXT
Code Example
Ruby :: ruby find object identifier 
Ruby :: how to use action_view in console rails 
Ruby :: inverse of in rails 
Ruby :: OTP SMS Mobile Verification in Ruby 
Ruby :: ruby plus plus 
Ruby :: ruby hash merge vs merge! 
Ruby :: In Jekyll - get the parent url path of a collection 
Ruby :: ruby method 
Ruby :: hello world ruby 
R :: outlier tagging boxplot r 
R :: how to set a column as index r 
R :: scale between 0 and 1 R 
R :: r range with step 
R :: r read all files in folder 
R :: fourier in R 
R :: rename column in r 
R :: how to create dictionary in R 
R :: regex in r 
R :: na by column r 
R :: how to change the font of the xlab in plot in r 
R :: plot porportion bar chart in r 
R :: reorder columns in r 
R :: r remove spaces in column names 
R :: How to extract NA´s from a column? in R 
R :: generate bin frequency table in R 
R :: check argument of function in r 
R :: dotted y intercept line in ggplot 
R :: r studio 
Rust :: check if a file exists rust 
Rust :: remove file rust 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =