File tree Expand file tree Collapse file tree 1 file changed +0
-34
lines changed Expand file tree Collapse file tree 1 file changed +0
-34
lines changed Original file line number Diff line number Diff line change @@ -270,40 +270,6 @@ func postorderTraversal(root *TreeNode) (res []int) {
270
270
}
271
271
```
272
272
273
- javaScript:
274
-
275
- ``` js
276
-
277
- 前序遍历:
278
-
279
- var preorderTraversal = function (root , res = []) {
280
- if (! root) return res;
281
- res .push (root .val );
282
- preorderTraversal (root .left , res)
283
- preorderTraversal (root .right , res)
284
- return res;
285
- };
286
-
287
- 中序遍历:
288
-
289
- var inorderTraversal = function (root , res = []) {
290
- if (! root) return res;
291
- inorderTraversal (root .left , res);
292
- res .push (root .val );
293
- inorderTraversal (root .right , res);
294
- return res;
295
- };
296
-
297
- 后序遍历:
298
-
299
- var postorderTraversal = function (root , res = []) {
300
- if (! root) return res;
301
- postorderTraversal (root .left , res);
302
- postorderTraversal (root .right , res);
303
- res .push (root .val );
304
- return res;
305
- };
306
- ```
307
273
Javascript版本:
308
274
309
275
前序遍历:
You can’t perform that action at this time.
0 commit comments