Sorting and generating reduced words
We introduce a partial order on the set of all reduced words of a given permutation $ω$, called \emph{directed-braid poset} of $ω$. This poset enables us to produce two algorithms: One is a sorting algorithm applied on any reduced word of $ω$ and aims to obtained the natural word (lexicographically largest reduced word); the other one is a generation algorithm applied on the natural word and aims to obtained the set of all reduced words of $ω$.