private function findSurpriseValue( Node $pNode, $pSubstring ) {
        $length = $pNode->end - $pNode->start;
        $text   = implode('', $this->text);
        if ( ($pNode->start != -1 && $pNode->end != -1 ) ) { 
            // node is not the root node
            if ( substr( $text , $pNode->start, $length ) === $pSubstring ) { 
                // found substring
                return $pNode->surpriseValue;
            } elseif ( strlen( $pSubstring ) < $length && strlen( $pSubstring ) > 0 ) {
                // string is only substring of string represented by pNode
                $substringLength = strlen($pSubstring);
                for ( $i=0; $i < strlen($text) - $substringLength; $i++ ) { 
                    if ( substr( $text, $pNode->start + $i, $substringLength ) === $pSubstring) {
                        return $pNode->surpriseValue;
                    }
                }
            }

            // shorten
            $pSubstring = substr($pSubstring, $length, strlen($pSubstring));
        }

        // else check childnodes for substring of pSubstring
        // substring is pSubstring without the letters represented by pNode
        $ret = $this->upperBound;
        foreach ( $pNode->next as $childKey => $childValue ) {
            if ($ret != $this->upperBound) {
                // we found the substring in another path already
                return $ret;
            }
            // check begin of substring with begin 
            // of string represented by this node
            if ($childKey !== $pSubstring[0]) {
                // substring does not start with 
                // the same letter -> check other paths
                continue;
            }
            // found a child starting with the same letter -> check child
            $childNode          = $this->nodes[$childValue];
            $childNodeLength    = $childNode->end - $childNode->start;

            $ret = $this->findSurpriseValue( $childNode,  $pSubstring );
        }

        return $ret;

    }