An Algebraic Approach for the Search Space of Permutations with Repetition