Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1. public int count(String word){
  2.         //so, beginning a search
  3.         int count = 0;
  4.         Node currentBranch = root;
  5.        // Node branchParent = null
  6.         while true{
  7.             if(currentBranch==null){
  8.                    break;
  9.             }
  10.             if(data.equals(currentBranch.data){
  11.                    count++;
  12.             }
  13.             if(data.compareTo(currentBranch.data)>0){
  14.                    currentBranch = currentBranch.right;
  15.             }
  16.             else{
  17.                    currentBranch = currentBranch.left;
  18.             }
  19.         }
  20.         return count;
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement