code for decomposition a permutation into a product of transpositions

Правка en1, от Hot_Potato, 2020-09-01 20:25:48

Given a list of strings lst and a list of integers p, reorder lst so that every lst[i] gets placed to p[i]. I am trying to solve this by decomposing permutation p into a product of transposition(swaps) and then use those swaps to reorder lst.. can anyone give me the code for decomposing a permutation into a product of transpositions?

Теги #combinatorics

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en5 Английский Hot_Potato 2020-09-01 20:58:24 191 (published)
en4 Английский Hot_Potato 2020-09-01 20:56:54 63 (saved to drafts)
en3 Английский Hot_Potato 2020-09-01 20:28:55 0 (published)
en2 Английский Hot_Potato 2020-09-01 20:27:23 4 (saved to drafts)
en1 Английский Hot_Potato 2020-09-01 20:25:48 406 Initial revision (published)