Linear extension of the Robinson–Schensted algorithm