Row insertion (source code)

= Row insertion
{title2=$P\leftarrow x$}

Insert $x$ into the first row of a <Young tableau> by replacing its leftmost entry strictly greater than $x$, and carry the displaced entry into the next row. If no entry is greater, append $x$ and stop. The procedure preserves a <semistandard Young tableau>; when all entries are distinct it preserves a <near Young tableau>. It underlies the <Robinson–Schensted correspondence>.