java - Keeping a count in a Binary Tree -


i new java, , working on recursion , binary trees. have assignment loads large file , creates binary tree each word. in each node, have stored word string , frequency int number of times word occurs in file.

i wrote program, reason getting number different professor said should get.

private int finduniquewords(node subtree, int uniquecount) {      // base case: @ end of branch     if(subtree == null){         return uniquecount;      //the word occurs 1 time     } else if(subtree.getfreqcount() == 1){          uniquecount++;     }       //find count in left branches     uniquecount = finduniquewords(subtree.getlchild(), uniquecount);      //find count in right branches , return     return finduniquewords(subtree.getrchild(), uniquecount); } 

as far know, file has loaded tree correctly, because of other answers in assignment correct. doing wrong?