1 parent 61d16c9 commit 8e65beeCopy full SHA for 8e65bee
2 files changed
…Inorder Traversal/AC_Iterable_stack.java …norder Traversal/AC_Iteration_stack.javasolutions/94. Binary Tree Inorder Traversal/AC_Iterable_stack.java renamed to solutions/94. Binary Tree Inorder Traversal/AC_Iteration_stack.java
solutions/94. Binary Tree Inorder Traversal/AC_recursion.java
@@ -0,0 +1,26 @@
1
+/**
2
+ * Definition for a binary tree node.
3
+ * public class TreeNode {
4
+ * int val;
5
+ * TreeNode left;
6
+ * TreeNode right;
7
+ * TreeNode(int x) { val = x; }
8
+ * }
9
+ */
10
+public class Solution {
11
+ private List<Integer> res = new ArrayList<Integer>();
12
+ public List<Integer> inorderTraversal(TreeNode root) {
13
+ if(root != null){
14
+ helper(root);
15
+ }
16
+ return res;
17
18
+
19
+ private void helper(TreeNode root) {
20
+ if (root != null) {
21
+ helper(root.left);
22
+ res.add(root.val);
23
+ helper(root.right);
24
25
26
+}
0 commit comments