Say I have an array that goes like [ a, c, b, d ] and I want it rearranged as [ d, c, a, b ]. The only type of change I'm allowed to make is plucking an element from one place and inserting it into another. Also, the array stays continuous with no empty indices, for example if I pluck c from [ a, c, b, d ] it becomes [ a, b, d ] until I reinsert c.
Is there an algorithm to figure out a minimal sequence of such changes in order to complete the transformation?