Inserting a sentence into search trees
Search trees of various sorts can work with an arbitrary ordered domain, as all they rely on is a comparison function which is assumed to satisfies the axioms of a complete order:


If $a &lt; b$ and $b &lt; c$ then $a &lt; c$.
Exactly one of $a &lt; b$, $a = b$, $a &gt; b$ (shorthand for $b &lt; a$) holds.


In your case, you're probably meant to use the lexicographic order on strings. In this order, $x &lt; y$ if:


Either $x$ and $y$ first differ in the $i$th symbol, and $x_i &lt; y_i$;
Or $x$ is a prefix of $y$.


Symbols are probably compared in ASCII order in your case.