Abstract

A permutation is happy, if it can be transformed into the identity permutation using as many short swaps as one third times the number of inversions in the permutation. The complexity of the decision version of sorting a permutation by short swaps, is still open. We present an O(n) time algorithm to decide whether it is true for a permutation to be happy, where n is the number of elements in the permutation. If a permutation is happy, we give an $$O(n^2)$$ time algorithm to find a sequence of as many short swaps as one third times the number of its inversions, to transform it into the identity permutation. A permutation is lucky, if it can be transformed into the identity permutation using as many short swaps as one fourth times the length sum of the permutation’s element vectors. We present an O(n) time algorithm to decide whether it is true for a permutation to be lucky, where n is the number of elements in the permutation. If a permutation is lucky, we give an $$O(n^2)$$ time algorithm to find a sequence of as many short swaps as one fourth times the length sum of its element vectors to transform it into the identity permutation. This improves upon the $$O(n^2)$$ time algorithm proposed by Heath and Vergara to decide whether a permutation is lucky. We show that there are at least $$2^{\lceil \frac{n}{2}\rceil -2}$$ happy permutations as well as $$2^{n-4}$$ lucky permutations of n elements.

Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.