mirror of
https://github.com/TheAlgorithms/Ruby
synced 2024-12-27 21:58:57 +01:00
fix syntax of data_structures
This commit is contained in:
parent
04fd348291
commit
9c1823739c
5 changed files with 54 additions and 55 deletions
|
@ -76,5 +76,4 @@ class SingleList
|
|||
def isEmpty()
|
||||
return (@head==nil)
|
||||
end
|
||||
|
||||
end
|
|
@ -15,9 +15,9 @@ def inorder_traversal(root)
|
|||
if node != nil
|
||||
traverse(node.left, ans)
|
||||
ans.push(node.val)
|
||||
traverse(node.right,ans)
|
||||
traverse(node.right, ans)
|
||||
end
|
||||
end
|
||||
traverse(root,ans)
|
||||
traverse(root, ans)
|
||||
return ans
|
||||
end
|
|
@ -14,10 +14,10 @@ def postorder_traversal(root)
|
|||
def traverse(node, ans)
|
||||
if node != nil
|
||||
traverse(node.left, ans)
|
||||
traverse(node.right,ans)
|
||||
traverse(node.right, ans)
|
||||
ans.push(node.val)
|
||||
end
|
||||
end
|
||||
traverse(root,ans)
|
||||
traverse(root, ans)
|
||||
return ans
|
||||
end
|
|
@ -15,9 +15,9 @@ def preorder_traversal(root)
|
|||
if node != nil
|
||||
ans.push(node.val)
|
||||
traverse(node.left, ans)
|
||||
traverse(node.right,ans)
|
||||
traverse(node.right, ans)
|
||||
end
|
||||
end
|
||||
traverse(root,ans)
|
||||
traverse(root, ans)
|
||||
return ans
|
||||
end
|
Loading…
Reference in a new issue