Robinson-Schensted algorithm