Using C++ next_permutation:
sort(arr.begin(), arr.end())
do {
// process current permutation
} while (next_permutation(arr.begin(), arr.end()))
Using Python itertools:
from itertools import permutations
for perm in permutations(arr):
# process perm
Manual recursion: Use the backtracking template with used array.
Time: . There are permutations, each taking to process.
When feasible: gives permutations.