这是我的函数,我用我的树的根节点和树内的一个字符来播种它。它成功地将要搜索的字母返回给我,但它没有给我元素的路径。我有点卡住了,任何帮助都会得到帮助
公共节点遍历树(节点根,字符串 charToFind){
    Node tempRoot = root;
    if (root != null){
        if (charToFind.equals(root.getAlphabet()))
        {
            //Another Point of consideration
            System.out.print(root.getAlphabet());
            System.out.println(": "+pathCodes);
            pathCodes.clear();
            return root;
        }
        Node result;
        if ((result = traversingTree(root.leftChild, charToFind)) != null){
            pathCodes.add("0");
            return result;
        }else
            pathCodes.add("1");
            return traversingTree(root.rightChild, charToFind); 
        }
        }
    pathCodes.clear();
     return null;
}