# Sort the given list efficiently [closed]

Consider you have a permutation of $$1$$ to $$n$$ in an array $$s$$. Now select three distinct indices $$a$$,$$b$$,$$c$$,need not to be sorted. Let $$s_a$$, $$s_b$$ and $$s_c$$ be the values at those indices and now you make a right shift to it ,that is $$new$$ $$s_a$$= $$old$$ $$s_b$$ and $$new$$ $$s_b$$= $$old$$ $$s_c$$ and $$new$$ $$s_c$$=$$old$$ $$s_a$$. Find the minimum number of operations required to sort the array or if is impossible how to determine it.

Example : Consider $$s= [2, 1, 3]$$; consider indices $$(1,3,2)$$ in the given order after applying one opeartion it is $$s =[1,2,3]$$.

I am thinking of applying a graph approach and solve it using graph traversal, am I right? Or you could explain your apporach.