diff --git a/problems/二叉树的递归遍历.md b/problems/二叉树的递归遍历.md index ba13fc74..c481fd11 100644 --- a/problems/二叉树的递归遍历.md +++ b/problems/二叉树的递归遍历.md @@ -270,40 +270,6 @@ func postorderTraversal(root *TreeNode) (res []int) { } ``` -javaScript: - -```js - -前序遍历: - -var preorderTraversal = function(root, res = []) { - if (!root) return res; - res.push(root.val); - preorderTraversal(root.left, res) - preorderTraversal(root.right, res) - return res; -}; - -中序遍历: - -var inorderTraversal = function(root, res = []) { - if (!root) return res; - inorderTraversal(root.left, res); - res.push(root.val); - inorderTraversal(root.right, res); - return res; -}; - -后序遍历: - -var postorderTraversal = function(root, res = []) { - if (!root) return res; - postorderTraversal(root.left, res); - postorderTraversal(root.right, res); - res.push(root.val); - return res; -}; -``` Javascript版本: 前序遍历: