MCPcopy Create free account
hub / github.com/codedecks-in/LeetCode-Solutions / inorder

Method inorder

Java/binary-tree-inorder-traversal.java:22–36  ·  view source on GitHub ↗
(TreeNode root, List<Integer> list)

Source from the content-addressed store, hash-verified

20 }
21
22 public void inorder(TreeNode root, List<Integer> list){
23 /* Inorder traversal is visiting : left subtree then root then right subtree */
24
25 /* if node is null, then return back to the caller function */
26 if(root==null)
27 return;
28 /* Recurse for left subtree */
29 inorder(root.left, list);
30
31 /* Add the current node's value to the list */
32 list.add(root.val);
33
34 /* Recurse for right subtree */
35 inorder(root.right, list);
36 }
37}

Callers 1

inorderTraversalMethod · 0.95

Calls 1

addMethod · 0.45

Tested by

no test coverage detected