@@ -0,0 +1,2647 @@
+package binarytree;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.HashMap;%0Aimport java.util.LinkedList;%0Aimport java.util.List;%0Aimport java.util.Map;%0Aimport java.util.Queue;%0A%0Aimport datastructures.tree.BinaryTree;%0Aimport datastructures.tree.TreeNode;%0A%0Apublic class FullNodesInBinaryTree %7B%0A  private BinaryTree%3CInteger%3E tree = null;%0A  private Map%3CInteger, TreeNode%3CInteger%3E%3E nodesMap = null;%0A  private TreeNode%3CInteger%3E root = null;%0A%0A  public FullNodesInBinaryTree() %7B%0A    tree = new BinaryTree%3CInteger%3E();%0A    nodesMap = new HashMap%3CInteger, TreeNode%3CInteger%3E%3E();%0A  %7D%0A%0A  public void constructTree(String%5B%5D input) %7B%0A    for (String line : input) %7B%0A      String%5B%5D values = line.split(%22 %22);%0A      int val = 0;%0A      switch (values%5B0%5D) %7B%0A      case %22insertRoot%22:%0A        val = Integer.parseInt(values%5B1%5D);%0A        TreeNode%3CInteger%3E root = tree.insertRoot(val);%0A        if (root != null) %7B%0A          nodesMap.put(val, root);%0A          this.root = root;%0A        %7D%0A        break;%0A      case %22insertLeft%22:%0A        insert(values%5B1%5D, values%5B2%5D, true);%0A        break;%0A      case %22insertRight%22:%0A        insert(values%5B1%5D, values%5B2%5D, false);%0A        break;%0A      %7D%0A    %7D%0A  %7D%0A%0A  public List%3CInteger%3E getFullNodes() %7B%0A    List%3CInteger%3E fullNodesList = new ArrayList%3CInteger%3E();%0A    getFullNodesDFS(root, fullNodesList);%0A    return fullNodesList;%0A  %7D%0A%0A  public List%3CInteger%3E getFullNodes2() %7B%0A    List%3CInteger%3E fullNodesList = new ArrayList%3CInteger%3E();%0A    Queue%3CTreeNode%3CInteger%3E%3E queue = new LinkedList%3CTreeNode%3CInteger%3E%3E();%0A    queue.add(root);%0A%0A    while (!queue.isEmpty()) %7B%0A      TreeNode%3CInteger%3E current = queue.poll();%0A      if (current.left != null && current.right != null) %7B%0A        fullNodesList.add(current.data);%0A      %7D%0A%0A      if (current.left != null) %7B%0A        queue.add(current.left);%0A      %7D%0A%0A      if (current.right != null) %7B%0A        queue.add(current.right);%0A      %7D%0A    %7D%0A%0A    return fullNodesList;%0A  %7D%0A%0A  private void getFullNodesDFS(TreeNode%3CInteger%3E root, List%3CInteger%3E fullNodesList) %7B%0A    if (root == null) %7B%0A      return;%0A    %7D%0A%0A    if (root.left != null && root.right != null) %7B%0A      fullNodesList.add(root.data);%0A    %7D%0A%0A    getFullNodesDFS(root.left, fullNodesList);%0A    getFullNodesDFS(root.right, fullNodesList);%0A  %7D%0A%0A  private void insert(String parentStr, String nodeStr, boolean isLeft) %7B%0A    int parentVal = Integer.parseInt(parentStr);%0A    int nodeVal = Integer.parseInt(nodeStr);%0A    TreeNode%3CInteger%3E parentNode = nodesMap.get(parentVal);%0A    if (parentNode == null) %7B%0A      return;%0A    %7D%0A%0A    TreeNode%3CInteger%3E node = new TreeNode%3CInteger%3E(nodeVal);%0A    nodesMap.put(nodeVal, tree.insert(parentNode, node, isLeft));%0A  %7D%0A%7D%0A

Add solution for FullNodesBinaryTree