class TreeSearch {

	public void preorderTraversal(TreeNode<T> root, T data){
		if(root == null){
			return;
		}
		
		if(!isSearched){
			if(!searchPath.toString().equals("")){
				searchPath.append("->");
			}
			searchPath.append(root.data);
			if(root.data.equals(data))
				isSearched = true;
		}
		
		if(!isSearched)
		    preorderTraversal(root.left, data);
		if(!isSearched)
		    preorderTraversal(root.right, data);
	}

}