fix syntax of data_structures

This commit is contained in:
Doppon 2020-05-14 11:05:14 +09:00
parent 04fd348291
commit 9c1823739c
5 changed files with 54 additions and 55 deletions

View file

@ -76,5 +76,4 @@ class SingleList
def isEmpty()
return (@head==nil)
end
end

View file

@ -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

View file

@ -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

View file

@ -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