public int findSubstring( char[] W )         
	{
		// starts with the root's son that has the first character of W 
		// as its incoming edge first character
		Node node = findSon( root, W[0] );
		int k,j = 0, nodeLabelEnd;

		// scan nodes down from the root until a leaf is reached or the 
		// substring is found 
		while ( node != null )
		{
		   k = node.edgeLabelStart;
		   nodeLabelEnd = getNodeLabelEnd( node );
	      // Scan a single edge - compare each character with the searched 
		  // string
	      while ( j < W.length && k <= nodeLabelEnd && treeString[k] 
	           == W[j] )
	      {
	         j++;
	         k++;
	      }
	      // checking which of the stopping conditions are true 
	      if ( j == W.length )
	      {
	    	  // W was found - it is a substring. Return its path starting 
	    	  // index
	    	  return node.pathPosition;
	      }
	      else if ( k > nodeLabelEnd )
	    	  // current edge is found to match, continue to next edge
	    	  node = findSon( node, W[j] );
	      else
	      {
	    	  // one non-matching symbols is found - W is not a substring
	    	  return stError;
	      }
	   }
	   return stError;
	}